Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932685AbbLNTGp (ORCPT ); Mon, 14 Dec 2015 14:06:45 -0500 Received: from mail-oi0-f41.google.com ([209.85.218.41]:36127 "EHLO mail-oi0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932169AbbLNTGm (ORCPT ); Mon, 14 Dec 2015 14:06:42 -0500 MIME-Version: 1.0 In-Reply-To: <566D3EC0.50408@ladisch.de> References: <566D3EC0.50408@ladisch.de> Date: Tue, 15 Dec 2015 00:36:41 +0530 Message-ID: Subject: Re: Ques: [kernel/time/*] Is there any disadvantage in using sleep_range for more than 20ms delay ? From: Aniroop Mathur To: Thomas Gleixner , Clemens Ladisch , John Stultz Cc: a.mathur@samsung.com, "linux-kernel@vger.kernel.org" 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-Length: 1845 Lines: 52 On Sun, Dec 13, 2015 at 3:17 PM, Clemens Ladisch wrote: > Aniroop Mathur wrote: >>> 1. If we choose usleep_range to acheive accuracy, are cpu and power usage >>> of any concern in real sense ? > > That depends. The effects are worse if the CPU is sleeping, and slow to > wake up. > > But that's _your_ job to decide. (And you know your hardware better.) > Umm... could you please elaborate it ? >>> 2. If we use msleep(40), is it possible that process could wake up after >>> 60 ms or 70 ms or 100 ms or more ? > > Yes, if lots of other processes compete for the CPU. > > You mean to say "yes" for process competing for changing state from "waiting" to "ready" or "ready" to "running" ? Regarding above, could you please help to confirm below things? 1. Using msleep(40) with HZ=1000 (1ms), process can still be in "waiting" state and will not move to "ready" state even after 42,45 or 50 ms. Right ? 2. Using usleep_range(40000, 41000), it is guaranteed that process will change its state from waiting to ready state before or at 41 ms. Right ? Regarding usleep_range disadvatage: 1. Usleep_range has a disadvantage that it does not allow the system to do optimal timer batching for power savings. Except that, Is there any other disadvantage ? 2. Is the impact of optimal timer batching in systems like android or ubuntu with moderate cpu speed significant or it can be negligible also? To understand the impact better, it would be really appreciating if you could kindly explain in detail with some case and data input. Regards, Aniroop Mathur > Regards, > Clemens -- 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/