Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932814AbcL0V4m (ORCPT ); Tue, 27 Dec 2016 16:56:42 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:56039 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932298AbcL0V4e (ORCPT ); Tue, 27 Dec 2016 16:56:34 -0500 Date: Tue, 27 Dec 2016 22:56:26 +0100 From: Pavel Machek To: Nicholas Mc Guire Cc: Thomas Gleixner , Jonathan Corbet , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: Re: [PATCH] doc: add note on usleep_range range Message-ID: <20161227215626.GA5336@amd> References: <1481601523-14004-1-git-send-email-hofrat@osadl.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nFreZHaLTZJo0R7j" Content-Disposition: inline In-Reply-To: <1481601523-14004-1-git-send-email-hofrat@osadl.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2548 Lines: 73 --nFreZHaLTZJo0R7j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue 2016-12-13 04:58:43, Nicholas Mc Guire wrote: > useleep_range() with a delta of 0 makes no sense and only prevents the > timer subsystem from optimizing interrupts. As any user of usleep_range() > is in non-atomic context the timer jitter is in the range of 10s of=20 > microseconds anyway. >=20 > This adds a note making it clear that a range of 0 is a bad idea. >=20 > Signed-off-by: Nicholas Mc Guire > --- >=20 > as of 4.9.0 there are about 20 cases of usleep_ranges() that have=20 > min=3D=3Dmax and none of them really look like they are necessary, so=20 > it does seem like a relatively common misunderstanding worth > noting in the documentation. >=20 > Patch is against 4.9.0 (localversion-next is 20161212) >=20 > Documentation/timers/timers-howto.txt | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/Documentation/timers/timers-howto.txt b/Documentation/timers= /timers-howto.txt > index 038f8c7..b5cdf82 100644 > --- a/Documentation/timers/timers-howto.txt > +++ b/Documentation/timers/timers-howto.txt > @@ -93,6 +93,13 @@ NON-ATOMIC CONTEXT: > tolerances here are very situation specific, thus it > is left to the caller to determine a reasonable range. > =20 > + A range of 0, that is usleep_range(100,100) or the=20 > + like, do not make sense as this code is in a=20 > + non-atomic section and a system can not be expected=20 > + to have jitter 0. For any non-RT code any delta Would it be possible to fix english here? "to have zero jitter" at least. I believe it is "does not". I don't see how atomic vs. non-atomic context makes difference. There are sources of jitter that affect atomic context... > + less than 50 microseconds probably is only preventing > + timer subsystem optimization but providing no benefit. And I don't trust you here. _If_ it prevents timer optimalization, _then_ it provides benefit, at least in the average case. Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --nFreZHaLTZJo0R7j Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlhi44oACgkQMOfwapXb+vJBiQCeK1PRrK0Ck9bhMIYF7bQIIpSA 8ygAoITV5c7YJnNaZnpld2qV+QRGdR+B =hImY -----END PGP SIGNATURE----- --nFreZHaLTZJo0R7j--