All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roman Zippel <zippel@linux-m68k.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] msleep() with hrtimers
Date: Fri, 10 Aug 2007 00:31:23 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0708100020050.1817@scrub.home> (raw)
In-Reply-To: <20070807211401.7078c12d.akpm@linux-foundation.org>

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

  reply	other threads:[~2007-08-09 22:31 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-03 18:37 [PATCH] msleep() with hrtimers Jonathan Corbet
2007-08-03 18:54 ` Ingo Molnar
2007-08-03 19:19 ` Roman Zippel
2007-08-03 19:46   ` Arjan van de Ven
2007-08-03 19:58     ` Roman Zippel
2007-08-03 23:53       ` Arjan van de Ven
2007-08-04  3:00         ` Roman Zippel
2007-08-04 19:19           ` Arjan van de Ven
2007-08-06  0:09             ` Roman Zippel
2007-08-06  0:43               ` Arjan van de Ven
2007-08-06  1:03                 ` Roman Zippel
2007-08-06  5:39                   ` Arjan van de Ven
2007-08-06 10:03                     ` Roman Zippel
2007-08-06 10:20                       ` Manu Abraham
2007-08-06 15:53                       ` Arjan van de Ven
2007-08-07 10:40                         ` Manu Abraham
2007-08-07 12:45                         ` Roman Zippel
2007-08-08  4:15                           ` Arjan van de Ven
2007-08-09 19:31                             ` Denis Vlasenko
2007-08-09 20:01                               ` Denis Vlasenko
2007-08-07 19:40 ` Andrew Morton
2007-08-07 23:16   ` Roman Zippel
2007-08-07 23:29     ` Andrew Morton
2007-08-08  3:47       ` Roman Zippel
2007-08-08  4:14         ` Andrew Morton
2007-08-09 22:31           ` Roman Zippel [this message]
2007-08-08 11:55   ` Andi Kleen
2007-08-08 11:09     ` Manu Abraham
2007-08-08 11:52       ` Andi Kleen
2007-08-08 11:59         ` Manu Abraham
2007-08-09  7:16 ` Andrew Morton
2007-08-09 15:08   ` [linux-usb-devel] " Alan Stern
2007-11-28 10:29 ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0708100020050.1817@scrub.home \
    --to=zippel@linux-m68k.org \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.