Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1464744

Re: [PATCH] timer: Make msleep(0) a nop

From John Stultz <john.stultz@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH] timer: Make msleep(0) a nop
Date 2016-08-17 21:40 +0200
Message-ID <s7eQV-5ow-1@gated-at.bofh.it> (permalink)
References <s5gk9-7MR-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Aug 12, 2016 at 1:40 AM,  <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Thanks to the msecs_to_jiffies()+1 msleep(0) may actually sleep for up
> to one jiffy. Presumably the caller should be satisfied if we "sleep"
> for 0 jiffies instead of 0-1 jiffies, so let's just turn msleep(0)
> into a nop.
>
> This can simplify some callers as they don't have to check for the
> 0 msecs case themselves anymore. Or if they're not checking for 0,
> they might avoid a needless sleep occasionally.
>
> A slight concern might be that someone is calling msleep(0) and
> depending on some delay being there. But that can clearly blow up
> even without this change, so I'm not overly worried about it.

I think this is more then a slight concern. Calls to *sleep() make
sure to sleep for at least the amount of time specified, but there is
no upper bound on how long that sleep might actually be. So msleep(0)
sleeping for 1 jiffy or more is correct. And when folks want the
minimum sleep granularity, msleep(0) is a valid way to get that.

So I don't think this is a good idea to change, at least w/o a much
stronger rational.

thanks
-john

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] timer: Make msleep(0) a nop ville.syrjala@linux.intel.com - 2016-08-12 10:50 +0200
  Re: [PATCH] timer: Make msleep(0) a nop John Stultz <john.stultz@linaro.org> - 2016-08-17 21:40 +0200

csiph-web