From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753813AbcHQTj0 (ORCPT ); Wed, 17 Aug 2016 15:39:26 -0400 Received: from mail-oi0-f54.google.com ([209.85.218.54]:32819 "EHLO mail-oi0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753180AbcHQTjY (ORCPT ); Wed, 17 Aug 2016 15:39:24 -0400 MIME-Version: 1.0 In-Reply-To: <1470991213-12086-1-git-send-email-ville.syrjala@linux.intel.com> References: <1470991213-12086-1-git-send-email-ville.syrjala@linux.intel.com> From: John Stultz Date: Wed, 17 Aug 2016 12:39:23 -0700 Message-ID: Subject: Re: [PATCH] timer: Make msleep(0) a nop To: =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= Cc: lkml , Thomas Gleixner Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id u7HJdUma018147 On Fri, Aug 12, 2016 at 1:40 AM, wrote: > From: Ville Syrjälä > > 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