Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Sep 2009 14:13:03 +0200
From:      Pieter de Goeje <pieter@degoeje.nl>
To:        freebsd-questions@freebsd.org
Cc:        Agus <agus.262@gmail.com>
Subject:   Re: Polling and kern.hz
Message-ID:  <200909201413.03882.pieter@degoeje.nl>
In-Reply-To: <fda61bb50909191316v37959eebr26394e8f2ae52670@mail.gmail.com>
References:  <fda61bb50909191316v37959eebr26394e8f2ae52670@mail.gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Saturday 19 September 2009, Agus wrote:
> Hi guys...
>
> Im reading ant playing with polling and kernel..... I read that
> polling increase net performance and i plan on using it... Now the
> question that arises is.. is polling and performance in general
> affected by the value of kern.hz? i have put in /boot.loader.con
> kern.hz=50 and was wondering if this number affects the number i
> choose for the polling options
>
> I wanna recompile kernel using
>
> options DEVICE_POLLING
>  options HZ=1000
>
> So that 1000hz how affects the system? if it affects it at all........
>
> thanks for anyone who can give me a hint....
>
> Cheers,
> A

To quote polling(4):
"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."

HZ affects how often the device is polled. For high bandwidth situations, it 
is important that the latency is kept as low as possible. That means that you 
must poll the device as often as possible. So generally people use very high 
HZ values for polling, for example 10000. HZ=50 leads to latencies of about 
20ms, way too high for normal network I/O.

Note that you can change HZ without recompiling by specifying kern.hz="###" in 
loader.conf.

-- 
Pieter de Goeje



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?200909201413.03882.pieter>