All of lore.kernel.org
 help / color / mirror / Atom feed
* DEVICE POLLING
@ 2006-02-02  8:45 kasp
  2006-02-02  9:04 ` David S. Miller
  2006-02-02 14:39 ` Alan Cox
  0 siblings, 2 replies; 5+ messages in thread
From: kasp @ 2006-02-02  8:45 UTC (permalink / raw)
  To: linux-kernel

Hello!

I've read that *BSD like systems support device polling:

------------------------------------------------------------
You  can  enable DEVICE_POLLING in your kernel. DEVICE_POLLING changes
the  method  through  which  data  gets  from your network card to the
kernel. Traditionally, each time the network card needs attention (for
example when it receives a packet), it generates an interrupt request.
The  request  causes  a  context  switch  and  a  call to an interrupt
handler.  A  context  switch is when the CPU and kernel have to switch
from  user  land  (the  user's  programs  or daemons), and kernel land
(dealing with device drivers, hardware, and other kernel-bound tasks).
The   last  few  years  have  seen  significant  improvements  in  the
efficiency of context switching but it is still an extremely expensive
operation.  Furthermore,  the  amount  of  time the system can have to
spend  when  dealing  with an interrupt can be almost limitless. It is
completely possible for an interrupt to never free the kernel, leaving
your machine unresponsive. Those of us unfortunate enough to be on the
wrong side of certain Denial of Service attacks will know about this.

The  DEVICE_POLLING option changes this behavior. It causes the kernel
to  poll  the  network  card  itself  at  certain predefined times: at
defined  intervals,  during  idle  loops, or on clock interrupts. This
allows the kernel to decide when it is most efficient to poll a device
for  updates and for how long, and ultimately results in a significant
increase in performance.

If  you  want to take advantage of DEVICE_POLLING, you need to compile
two options in to your kernel:

    * options DEVICE_POLLING
    * options HZ=1000

The  first line enables DEVICE_POLLING and the second device slows the
clock  interrupts  to  1000  times  per  second. The need to apply the
second,  because in the worst case your network card will be polled on
clock  ticks.  If  the clock ticks very fast, you would spend a lot of
time polling devices which defeats the purpose here.

Finally  we need to change one sysctl to actually enable this feature.
You  can  either  enable polling at runtime or at boot. If you want to
enable it at boot, add this line to the end of your /etc/sysctl.conf:

    * kern.polling.enable=1

The  DEVICE_POLLING  option  by default does not work with SMP enabled
kernels. When the author of the DEVICE_POLLING code initially commited
it  he  admits  he  was  unsure  of  the  benefits of the feature in a
multiple-CPU  environment, as only one CPU would be doing the polling.
Since  that  time  many  administrators  have  found  that  there is a
significant  advantage  to  DEVICE_POLLING even in SMP enabled kernels
and that it works with no problems at all. If you are compiling an SMP
kernel       with       DEVICE_POLLING,       edit      the      file:
/usr/src/sys/kern/kern_poll.c and remove the following lines:

        #ifdef SMP
        #include "opt_lint.h"
        #ifndef COMPILING_LINT
        #error DEVICE_POLLING is not compatible with SMP
        #endif
        #endif
      
---------------------------------------------------------------------------
  

So, are there any feature like that in linux kernel supported?

P.S. http://silverwraith.com/papers/freebsd-tuning.php

-- 
Best regards,
 kasp                          mailto:waters@inbox.lv


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DEVICE POLLING
  2006-02-02  8:45 DEVICE POLLING kasp
@ 2006-02-02  9:04 ` David S. Miller
  2006-02-02 14:39 ` Alan Cox
  1 sibling, 0 replies; 5+ messages in thread
From: David S. Miller @ 2006-02-02  9:04 UTC (permalink / raw)
  To: waters; +Cc: linux-kernel

From: kasp <waters@inbox.lv>
Date: Thu, 2 Feb 2006 10:45:54 +0200

> So, are there any feature like that in linux kernel supported?

Yes, it's called NAPI and it's on by default in many drivers.

But this is ancient history and a better scheme for dealing these
issues is coming soon, in the form of Van Jacobson's net channels.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DEVICE POLLING
  2006-02-02  8:45 DEVICE POLLING kasp
  2006-02-02  9:04 ` David S. Miller
@ 2006-02-02 14:39 ` Alan Cox
  2006-02-02 15:55   ` Re[2]: " kasp
  1 sibling, 1 reply; 5+ messages in thread
From: Alan Cox @ 2006-02-02 14:39 UTC (permalink / raw)
  To: kasp; +Cc: linux-kernel

On Iau, 2006-02-02 at 10:45 +0200, kasp wrote:
> Hello!
> 
> I've read that *BSD like systems support device polling:
> So, are there any feature like that in linux kernel supported?

The Linux kernel does similar things for high network loads. Some serial
hardware also supports that functionality (eg comtrol rocketport).



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re[2]: DEVICE POLLING
  2006-02-02 14:39 ` Alan Cox
@ 2006-02-02 15:55   ` kasp
  2006-02-02 16:41     ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: kasp @ 2006-02-02 15:55 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Hello Alan,

Thursday, February 2, 2006, 4:39:47 PM, you wrote:

>> I've read that *BSD like systems support device polling:
>> So, are there any feature like that in linux kernel supported?

AC> The Linux kernel does similar things for high network loads. Some serial
AC> hardware also supports that functionality (eg comtrol rocketport).

Should I turn this feature somewhere on, or is it already enabled by default?
I'm using Intel PRO/100 network cards if it's important.

-- 
Best regards,
 kasp                            mailto:waters@inbox.lv


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re[2]: DEVICE POLLING
  2006-02-02 15:55   ` Re[2]: " kasp
@ 2006-02-02 16:41     ` Alan Cox
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Cox @ 2006-02-02 16:41 UTC (permalink / raw)
  To: kasp; +Cc: linux-kernel

On Iau, 2006-02-02 at 17:55 +0200, kasp wrote:
> Should I turn this feature somewhere on, or is it already enabled by default?
> I'm using Intel PRO/100 network cards if it's important.

Its the "NAPI" options in the make config stage. Or see the NAPI howto
in the kernel source tree


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-02-02 16:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-02  8:45 DEVICE POLLING kasp
2006-02-02  9:04 ` David S. Miller
2006-02-02 14:39 ` Alan Cox
2006-02-02 15:55   ` Re[2]: " kasp
2006-02-02 16:41     ` Alan Cox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.