Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755881AbbLHCpr (ORCPT ); Mon, 7 Dec 2015 21:45:47 -0500 Received: from mail-ob0-f172.google.com ([209.85.214.172]:33361 "EHLO mail-ob0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755267AbbLHCpq (ORCPT ); Mon, 7 Dec 2015 21:45:46 -0500 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 8 Dec 2015 08:15:46 +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 Cc: John Stultz , 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: 1544 Lines: 38 On Tue, Dec 8, 2015 at 12:07 AM, Thomas Gleixner wrote: > On Mon, 7 Dec 2015, Aniroop Mathur wrote: >> As in the kernel documentation, it is mentioned to use msleep for >> 10ms+ delay, I am confused whether there would be any disadvantage in >> using usleep_range for higher delays values because normally drivers >> have variety of delays used (2, 10, 20, 40, 100, 500 ms). > > The real question is how precise must your delay be? If the delay > needs to be precise within the min/max sleep time limits, then > usleep_range() is probably the way to go. If the delay can be > imprecise then using msleep() is the right way because that lets the > kernel batch timers for power saving purposes. > Thank you for the answer ! Normally, we insert delays in driver while enabling the chip. So here usleep_range seems to service better as we do not want to delay the initialisation process of chip and make it ready to generate data, especially for faster devices like sensor. One last thing, Considering HZ=100, would the power saving be same if we set the range in usleep_range equivalent to msleep ? For example: msleep (33) and usleep_range(33000, 40000) So for such case, would both have same impact on power saving ? Best Regards, Aniroop Mathur > Thanks, > > tglx -- 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/