polling man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

POLLING(4)		 BSD Kernel Interfaces Manual		    POLLING(4)

NAME
     polling — device polling support

SYNOPSIS
     options DEVICE_POLLING

DESCRIPTION
     Device 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 perfor‐
     mance.

     In particular, polling reduces the overhead for context switches which is
     incurred when servicing interrupts, and gives more control on the sched‐
     uling of a CPU between various tasks (user processes, software inter‐
     rupts, device handling) which ultimately reduces the chances of livelock
     in the system.

   Principles of Operation
     In the normal, interrupt-based mode, devices generate an interrupt when‐
     ever 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 poten‐
     tially unbounded unless the device driver has been programmed with real-
     time concerns in mind (which is generally not the case for DragonFly
     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 on clock inter‐
     rupts.  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 polling also changes the way software network interrupts are
     scheduled, so there is never the risk of livelock because packets are not
     processed to completion.

   Enabling polling
     Currently only network interface drivers support the polling feature.  It
     is turned on and off with help of ifconfig(8) command.  An interface does
     not have to be “up” in order to turn on its polling feature.

   Loader Tunables
     The following tunables can be set from loader.conf(5):
     kern.polling.enable
	     If set to non-zero, polling is enabled.  Default is enabled.

     kern.polling.cpumask
	     A bitmask that controls which CPUs support device polling.
	     Default is 0xffffffff.

   MIB Variables
     The operation of polling is controlled by the following per CPU sysctl(8)
     MIB variables (X is the CPU number):

     kern.polling.X.enable
	     If set to non-zero, polling is enabled.  Default is enabled.

     kern.polling.X.pollhz
	     The polling frequency, whose range is 1 to 30000.	Default is
	     2000.

     kern.polling.cpumask
	     A read only bitmask of the CPUs that support device polling.

     kern.polling.defcpu
	     The default CPU used to run device polling (read only).

     kern.polling.X.user_frac
	     When polling is enabled, and provided that there is some work to
	     do, up to this percent of the CPU cycles is reserved to userland
	     tasks, the remaining fraction being available for polling pro‐
	     cessing.  Default is 50.

     kern.polling.X.burst
	     Maximum number of packets grabbed from each network interface in
	     each timer tick.  This number is dynamically adjusted by the ker‐
	     nel, according to the programmed user_frac, burst_max, CPU speed,
	     and system load.

     kern.polling.X.each_burst
	     The burst above is split into smaller chunks of this number of
	     packets, going round-robin among all interfaces registered for
	     polling.  This prevents the case that a large burst from a single
	     interface can saturate the IP interrupt queue
	     (net.inet.ip.intr_queue_maxlen).  Default is 5.

     kern.polling.X.burst_max
	     Upper bound for kern.polling.burst.  Note that when polling is
	     enabled, each interface can receive at most (pollhz * burst_max)
	     packets per second unless there are spare CPU cycles available
	     for polling in the idle loop.  This number should be tuned to
	     match the expected load (which can be quite high with GigE
	     cards).  Default is 150 which is adequate for 100Mbit network and
	     pollhz=1000.

     kern.polling.X.reg_frac
	     Controls how often (every reg_frac / pollhz seconds) the status
	     registers of the device are checked for error conditions and the
	     like.  Increasing this value reduces the load on the bus, but
	     also delays the error detection.  Default is 20.

     kern.polling.X.handlers
	     How many active devices have registered for polling.

     kern.polling.X.short_ticks
     kern.polling.X.lost_polls
     kern.polling.X.pending_polls
     kern.polling.X.residual_burst
     kern.polling.X.phase
     kern.polling.X.suspect
     kern.polling.X.stalled
	     Debugging variables.

SUPPORTED DEVICES
     Device polling requires explicit modifications to the device drivers.  As
     of this writing, the bce(4), bge(4), dc(4), em(4), fwe(4), fxp(4),
     jme(4), nfe(4), nge(4), re(4), rl(4), sis(4), stge(4), vge(4), vr(4),
     wi(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.)

     In order to reduce the latency in processing packets, it is advisable to
     set the sysctl(8) variable kern.polling.X.pollhz to at least 1000.

HISTORY
     Device polling first appeared in FreeBSD 4.6.  It was rewritten in
     DragonFly 1.3.

AUTHORS
     The device polling code was rewritten by Matt Dillon based on the origi‐
     nal code by Luigi Rizzo ⟨luigi@iet.unipi.it⟩.  Sepherosa Ziehau made the
     polling frequency settable at runtime and added per CPU polling.

BSD				October 2, 2007				   BSD
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net