Date: Thu, 22 Jul 2004 02:01:53 -0400 From: Chuck Swiger <cswiger@mac.com> To: John Birrell <jb@cimlogic.com.au> Cc: current@freebsd.org Subject: Re: nanosleep returning early Message-ID: <40FF5851.5080207@mac.com> In-Reply-To: <20040721215940.GK22160@freebsd3.cimlogic.com.au> References: <20040721081310.GJ22160@freebsd3.cimlogic.com.au> <20040721102620.GF1009@green.homeunix.org> <20040721220405.Y2346@epsplex.bde.org> <20040721215940.GK22160@freebsd3.cimlogic.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
John Birrell wrote: [ ... ] > Bruce, have you seen this document: <http://www.dragonflybsd.org/docs/nanosleep/>? > I'm not looking for a critique here. The document talks about the sleep > overruns in various operatingg systems. There is a patch that was applied > to DragonFly which a[p]plies to the FreeBSD code base too. This was a good link, BTW, John: thanks for the pointer. I've created diffs of containing the first part of the changes for -CURRENT and -STABLE at: http://www.pkix.net/~chuck/timer/timer-STABLE.diff http://www.pkix.net/~chuck/timer/timer-CURRENT.diff On a 4.10 P3-grade machine using HZ=1000, I get the following graphs for 200 seconds worth of the "wakeup.c" program: http://www.pkix.net/~chuck/timer/wakeup001.gif ...so the changes reduce the latency seen from around 1.2ms to around 0.46ms. The aliasing problem is still clearly visible since I haven't had a chance to test the second set of changes. Matt's PLL code in i386/isa/clock.c has diverged a fair amount and the Dfly code apparently no longer works on 486-grade hardware due to using 8254 timing modes, if I understand what's going on correctly, but just the improvement above seems quite worthwhile. I'm going to retest using HZ=100, too, to see what's going on under default conditions. Please note that the wakeup interval after the patch can go very slightly negative (by 5-10 us): I'm not sure whether my hardware clock is off or a little flaky in the microsecond range, whether there is some issue with nanosleep() waking things up a little early, or whether the diffs need to be tweaked more. Testing on a few other machines would be good. :-) -- -Chuck
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40FF5851.5080207>