Re: [PATCH] msleep() with hrtimers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, 7 Aug 2007, Andrew Morton wrote:

> > The current msleep is fine and doesn't need any "fixing".
> > Not all the world is i386, _please_ keep hrtimer usage where it's 
> > required. Simple timer should be given preference unless the higher 
> > resolution is really needed, which is not the case here.
> 
> Hang on.  Having msleep(1) sleep for 20 milliseconds is really awful
> behaviour.  Possibly worse is the fact that with other configs, it will
> delay for eight milliseconds.  Or two.  That's an order of magnitude of
> unpredictability which can actually cause driver breakage.
> 
> Fixing that *bug* is a good thing.  I see no reason why we should "keep
> hrtimer usage where it is required"?  The implementation details are hidden
> from the caller.

This is not a bug. You have to keep in mind that for hrtimer to make a 
real difference HIGH_RES_TIMERS has to be enabled, OTOH if HZ is already 
set to 1000, it doesn't make much difference.
The sleep was and will be only a minimum time, expecting something 
different is actually a bug.

> > so below is a nanosleep implementation based 
> > on Jonathan's patch. This will user give a choice, so there is no need to 
> > force all users to use hrtimer for a simple sleep.
> 
> But apart from needlessly fattening the kernel API, that leaves us in the
> current situation where an unknown number of the msleep() callers actually
> care that they are calling a function which by a huge margin fails to do
> what they are asking it to do.  It will take a long time to hunt down all
> the problematic callsites and migrate them to nanosleep().

As I tried to say before this is foremost an API issue. Introducing 
nanosleep() makes it clear that this user will benefit from enabling 
HIGH_RES_TIMERS, whereas msleep() says that resolution is not that 
important and thus it will work fine without HIGH_RES_TIMERS and/or 
HZ_1000.

bye, Roman
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux