Hello Lukas, Thanks for the feedback!
> We need someone to be able to test this, are you aware what nics currently > support busy polling? What about loopback? A loopback device would not work because busy polling requires a NAPI driver. > This seems to set busy polling unconditionally to 1 microsecond, I don't > think thats a good idea. Perhaps this should be made configurable? > Recommended value seem to be 50 or 100 us (see man 7 socket and [1])? Yep, you're absolutely right. My understanding was that the polling time was only set by the net.core.busy_read sysctl, but looking over the original patch set [1], that is not the case. I'll update the patch to set a value for busy poll. > Also, it looks to me like in this case we would also need to set the > busy_poll sysctl (we don't do blocking receives)? If thats the case we > will have to document it. I'm not sure about the blocking receives part, but I think busy polling is enabled/disabled globally with busy_poll sysctl, so changing it sounds dangerous. Perhaps we could warn the user in bind_parse_busy_poll if /proc/sys/net/core/busy_poll is 0 (and return ERR_ALERT | ERR_FATAL ?). > As for the docs, I think we should at least mention that: > - only certain nic drivers support busy polling > - it will increases power usage > - while busy_read sysctl is overwritten by the SO_BUSY_POLL socket option, > busy_poll must be set at sysctl level [1] Yes, those are all good points worth documenting. > Also, we should probably check the return code of setsockopt() and give > some feedback to the user whether the kernel accepted it, at the very > least in verbose or debug mode. Good idea. CAP_NET_ADMIN is required if the value is larger than the busy_read sysctl value. In that case, should it set ERR_ALERT? Or is there a more appropriate error flag? > Are there some applications or poc's already using busy polling where we > could take a look? Unfortunately, I have not found any other projects that support busy polling explicitly. HAProxy could be the first! -Ben [1]: http://kernelnewbies.org/Linux_3.11#head-e655ee02ba64c3261bf702eb01402464561efa1f

