All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] doc: add note on usleep_range range
@ 2016-12-13  4:05 Nicholas Mc Guire
  0 siblings, 0 replies; only message in thread
From: Nicholas Mc Guire @ 2016-12-13  4:05 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Jonathan Corbet, linux-kernel, linux-doc, Nicholas Mc Guire

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 
microseconds anyway.

This adds a note making it clear that a range of 0 is a bad idea.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

V2: trailing whitespaces removed (sent the wrong file before...)

as of 4.9.0 there are about 20 cases of usleep_ranges() that have 
min==max and none of them really look like they are necessary, so 
it does seem like a relatively common misunderstanding worth
noting in the documentation.

Patch is against 4.9.0 (localversion-next is 20161212)

 Documentation/timers/timers-howto.txt | 7 +++++++
 1 file changed, 7 insertions(+)

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.
 
+			A range of 0, that is usleep_range(100,100) or the
+			like, do not make sense as this code is in a
+			non-atomic section and a system can not be expected
+			to have jitter 0. For any non-RT code any delta
+			less than 50 microseconds probably is only preventing
+			timer subsystem optimization but providing no benefit.
+
 	SLEEPING FOR LARGER MSECS ( 10ms+ )
 		* Use msleep or possibly msleep_interruptible
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-12-13  4:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-13  4:05 [PATCH V2] doc: add note on usleep_range range Nicholas Mc Guire

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.