Re: [PATCH] Fix for sys_nanosleep() in 2.4.16

From: george anzinger (george@mvista.com)
Date: Thu Nov 29 2001 - 18:41:39 EST


Michael Arras wrote:
>
> Greetings,
>
> For many of us, the kernel thread scheduling resolution is
> 10ms (see getitimer(2)). By adding 1 jiffy to the time to
> sleep in sys_nanosleep(), threads are sleeping 10ms too long.
> timespec_to_jiffies() does a good job at returning the
> appropriate number of jiffies to sleep. There is no need to
> add one for good measure.
>
Not really. It depends on where the call is made with respect to the
next jiffies interrupt. The standard says that the call MUST not return
early, thus, on the chance that the current time is not exactly on a
jiffies edge, the one must be added. The average sleep should be 1/HZ+
1/(2*HZ) or 15ms, but never less than 10ms. For higher resolution stay
tuned to the high-res-timers project (see signature line).

-- 
George           george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
Real time sched: http://sourceforge.net/projects/rtsched/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Nov 30 2001 - 21:00:36 EST