polling(4) and idle time/cpu usage percentages

Luigi Rizzo rizzo at icir.org
Sun May 11 09:15:55 PDT 2003


On Sun, May 11, 2003 at 12:05:23PM -0400, Don Bowman wrote:
> From: Kevin Day [mailto:toasty at dragondata.com]
> > At 10:44 AM 5/11/2003, you wrote:
> > >I tried the hack, as below. The other thing that makes idle
> > >wildly inaccurate is the symmetric multi-threading on the xeon
> > >(aka hyperthreading).
> > 
> > Smack me if I'm wrong, but you can't compile the kernel with 
> > DEVICE_POLLING 
> > active at the same time as SMP. Without SMP you don't get any of the 
> > advantages/effects of HTT.
> > 
> > (or has polling been made to play nice with SMP in -current?)
> 
> DEVICE_POLLING actually works fine with SMP, there was just
> some question as to whether it was the best way to make use
> of the SMP. I just removed the #error in kern_poll.c in the
> #ifdef SMP case.

Interesting! Well, let's see:

The polling code (including the code that schedules the cpu
between kernel and userland) is written upon the assumption that only one
polling loop is active. Now, because polling can occur in the idle
loop or right after hardclock, and there are multiple concurrent
idle_loops in the SMP cases, and the locking is just not there.

Probably, the reason it works for you is that likely there is only
one instance of hardclock handler, _and_ the idle_loop code is
different for the UP and SMP cases, and I only provided polling
hooks for the former. So you are limited to doing polling only in
the assigned fraction of CPU, and the CPU(s) will not use any extra
CPU for polling even if available.

	cheers
	luigi

> _______________________________________________
> freebsd-net at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"


More information about the freebsd-net mailing list