From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932379AbbLGSir (ORCPT ); Mon, 7 Dec 2015 13:38:47 -0500 Received: from www.linutronix.de ([62.245.132.108]:41147 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754593AbbLGSiq (ORCPT ); Mon, 7 Dec 2015 13:38:46 -0500 Date: Mon, 7 Dec 2015 19:37:56 +0100 (CET) From: Thomas Gleixner To: Aniroop Mathur cc: John Stultz , a.mathur@samsung.com, "linux-kernel@vger.kernel.org" Subject: Re: Ques: [kernel/time/*] Is there any disadvantage in using sleep_range for more than 20ms delay ? In-Reply-To: Message-ID: References: User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, tglx