lkml.org 
[lkml]   [2003]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: ltp nanosleep02 test
Paul Larson wrote:
> On Mon, 2003-08-04 at 18:22, Andrew Morton wrote:
>
>>OK, thanks.
>>
>>Paul, if nanosleep2 is really dead then you should bury it and stop
>>scaring people ;)
>
> Actually this test will pass just fine if you increase USEC_PRECISION to
> something more reasonable than 100. However it looks like whoever wrote
> this test made it intentionally low. This is the comment right before
> the #define USEC_PRECISION 100:
> /*
> * Define here the "rem" precision in microseconds,
> * Various implementations will provide different
> * precisions. The -aa tree provides up to usec precision.
> * NOTE: all the trees that don't provide a precision of
> * the order of the microseconds are subject to an userspace
> * live lock condition with glibc under a flood of signals,
> * the "rem" field would never change without the increased
> * usec precision in the -aa tree.
> */
> So does anyone know if this patch from the -aa tree is reasonable or has
> a chance of making it into the mainline kernel? Does this livelock
> situation still exist or was it solved by other means? If this is no
> longer a potential problem then I will gladly remove the test.

I haven't seen the patch :( There is a little misdirection in that
comment, however. The kernel rounds up the time to the nearest
resolution and then adds that resolution (resolution is 1/HZ, by the
way). The round up is required by the standard as is the add. The
add is to make sure the expiry time is AFTER and never before the
requested time.

What is passed back as the remaining time is the true remaining time
after this calculation.

The live lock would occur if the caller then used that time to sleep
again (i.e. to complete the sleep) as the kernel would again add the
1/HZ to the given value. So each signal, the time would be extended
by a jiffie.

The best way to solve this is to use the absolute time version of
clock_nanosleep, but, sigh, that means a change in glibc.

--
George Anzinger george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.038 / U:4.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site