Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759604Ab2BOOyR (ORCPT ); Wed, 15 Feb 2012 09:54:17 -0500 Received: from casper.infradead.org ([85.118.1.10]:41737 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751061Ab2BOOyO convert rfc822-to-8bit (ORCPT ); Wed, 15 Feb 2012 09:54:14 -0500 Message-ID: <1329317650.2293.129.camel@twins> Subject: Re: [PATCH] hrtimers: Special-case zero length sleeps From: Peter Zijlstra To: Thomas Gleixner Cc: Matthew Garrett , LKML , Arjan van de Ven Date: Wed, 15 Feb 2012 15:54:10 +0100 In-Reply-To: References: <1317308372-6810-1-git-send-email-mjg@redhat.com> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Mailer: Evolution 3.2.2- Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1363 Lines: 30 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. -- 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/