Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756166AbbLHJEN (ORCPT ); Tue, 8 Dec 2015 04:04:13 -0500 Received: from smtprelay04.ispgateway.de ([80.67.31.32]:33677 "EHLO smtprelay04.ispgateway.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755129AbbLHJEH (ORCPT ); Tue, 8 Dec 2015 04:04:07 -0500 Subject: Re: Ques: [kernel/time/*] Is there any disadvantage in using usleep_range for more than 20ms delay ? To: Aniroop Mathur References: Cc: John Stultz , Thomas Gleixner , a.mathur@samsung.com, "linux-kernel@vger.kernel.org" From: Clemens Ladisch Message-ID: <56669CFF.8040806@ladisch.de> Date: Tue, 8 Dec 2015 10:03:59 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Df-Sender: bGludXgta2VybmVsQGNsLmRvbWFpbmZhY3Rvcnkta3VuZGUuZGU= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1109 Lines: 27 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). > > So, could you please help to confirm that if we use usleep_range for > inserting delays greater than 20 ms, would it be harmful or beneficial > or does not make any difference at all ? As the documentation told you, usleep_range() is likely to require a separate interrupt, while msleep() is likely to round to some other, already-scheduled interrupt. The former is possibly harmful regarding CPU and power usage; you have to balance it against your need for accuracy. (And usleep_range() has a 32-bit nanosecond limit on 32-bit architectures.) 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/