From: Peter Zijlstra <peterz@infradead.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Matthew Garrett <mjg@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
Arjan van de Ven <arjan@infradead.org>
Subject: Re: [PATCH] hrtimers: Special-case zero length sleeps
Date: Wed, 15 Feb 2012 15:54:10 +0100 [thread overview]
Message-ID: <1329317650.2293.129.camel@twins> (raw)
In-Reply-To: <alpine.LFD.2.02.1202151537500.2794@ionos>
On Wed, 2012-02-15 at 15:40 +0100, Thomas Gleixner wrote:
> On Thu, 29 Sep 2011, Matthew Garrett wrote:
>
> > sleep(0) is a common construct used by applications that want to trigger
> > the scheduler. sched_yield() might make more sense, but only appeared in
> > POSIX.1-2001 and so plenty of example code still uses the sleep(0) form.
Note that sched_yield() is unspecified for SCHED_OTHER, so any
application using it that is not a real-time application is outside spec
anyway.
Furthermore, both sched_yield() and sleep(0) are fair indications the
application is broken, wait for proper events, not random delays.
> > This wouldn't normally be a problem, but it means that event-driven
> > applications that are merely trying to avoid starving other processes may
> > actually end up sleeping due to having large timer_slack values. Special-
> > casing this seems reasonable.
Again, sleep granularity isn't specified and thus this behaviour isn't
actually buggy, all the spec promises is we won't sleep shorter than
asked.
Also, starvation avoidance isn't something that userspace should concern
itself with.
next prev parent reply other threads:[~2012-02-15 14:54 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-29 14:59 [PATCH] hrtimers: Special-case zero length sleeps Matthew Garrett
2012-02-15 14:40 ` Thomas Gleixner
2012-02-15 14:52 ` Matthew Garrett
2012-02-15 20:14 ` Thomas Gleixner
2012-02-15 20:22 ` Matthew Garrett
2012-02-15 20:30 ` Thomas Gleixner
2012-02-15 20:38 ` Matthew Garrett
2012-02-15 20:40 ` Peter Zijlstra
2012-02-15 20:43 ` Matthew Garrett
2012-02-15 20:46 ` Thomas Gleixner
2012-02-15 20:47 ` Matthew Garrett
2012-02-16 14:27 ` Matthew Garrett
2012-02-16 14:31 ` Alan Cox
2012-02-16 14:51 ` Peter Zijlstra
2012-02-16 15:01 ` Matthew Garrett
2012-02-16 19:09 ` Thomas Gleixner
2012-02-15 14:54 ` Peter Zijlstra [this message]
2012-02-15 14:58 ` Matthew Garrett
2012-02-15 20:22 ` Thomas Gleixner
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=1329317650.2293.129.camel@twins \
--to=peterz@infradead.org \
--cc=arjan@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjg@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox