|
NAMEpolling —
device polling support
SYNOPSISoptions DEVICE_POLLING
DESCRIPTIONDevice polling (polling for brevity) refers to a
technique that lets the operating system periodically poll devices, instead of
relying on the devices to generate interrupts when they need attention. This
might seem inefficient and counterintuitive, but when done properly,
polling gives more control to the operating system on
when and how to handle devices, with a number of advantages in terms of system
responsiveness and performance.
In particular, Principles of OperationIn the normal, interrupt-based mode, devices generate an interrupt whenever they need attention. This in turn causes a context switch and the execution of an interrupt handler which performs whatever processing is needed by the device. The duration of the interrupt handler is potentially unbounded unless the device driver has been programmed with real-time concerns in mind (which is generally not the case for FreeBSD drivers). Furthermore, under heavy traffic load, the system might be persistently processing interrupts without being able to complete other work, either in the kernel or in userland.Device polling disables interrupts by polling devices at appropriate times, i.e., on clock interrupts and within the idle loop. This way, the context switch overhead is removed. Furthermore, the operating system can control accurately how much work to spend in handling device events, and thus prevent livelock by reserving some amount of CPU to other tasks. Enabling Enabling pollingCurrently only network interface drivers support thepolling feature. It is turned on and off with help of
ifconfig(8)
command.
The historic kern.polling.enable, which enabled polling for all interfaces, can be replaced with the following code: for i in `ifconfig -l` ; do ifconfig $i polling; # use -polling to disable done MIB VariablesThe operation ofpolling is controlled by the following
sysctl(8)
MIB variables:
SUPPORTED DEVICESDevice polling requires explicit modifications to the device drivers. As of this writing, the bge(4), dc(4), em(4), fwe(4), fwip(4), fxp(4), igb(4), nfe(4), nge(4), re(4), rl(4), sis(4), ste(4), stge(4), vge(4), vr(4), and xl(4) devices are supported, with others in the works. The modifications are rather straightforward, consisting in the extraction of the inner part of the interrupt service routine and writing a callback function,*_poll (), which is invoked to probe the device for
events and process them. (See the conditionally compiled sections of the
devices mentioned above for more details.)
As in the worst case the devices are only polled on clock interrupts, in order to reduce the latency in processing packets, it is not advisable to decrease the frequency of the clock below 1000 Hz. HISTORYDevice polling first appeared in FreeBSD 4.6 and FreeBSD 5.0.AUTHORSDevice polling was written by Luigi Rizzo <luigi@iet.unipi.it>.
Visit the GSP FreeBSD Man Page Interface. |