diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2016-05-31 17:23:02 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-06-09 18:59:14 -0400 |
commit | b5227d03b7191a9a44bf75a4c228a6a9ddbe781b (patch) | |
tree | c9598d40a1161ddaf9afef234f8c6c2c4bc5dcaa | |
parent | 2895a5e5b3ae78d9923a91fce405d4a2f32c4309 (diff) |
timers: Clarify usleep_range() function comment
Update the usleep_range() function comment to make it clear that it can
only be used in non-atomic context.
Previously we claimed usleep_range() was a drop-in replacement for udelay()
where wakeup is flexible. But that's only true in non-atomic contexts,
where it's possible to sleep instead of delay.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: John Stultz <john.stultz@linaro.org>
Link: http://lkml.kernel.org/r/20160531212302.28502.44995.stgit@bhelgaas-glaptop2.roam.corp.google.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | kernel/time/timer.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 3a95f9728778..67dd6103003a 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c | |||
@@ -1702,9 +1702,15 @@ static void __sched do_usleep_range(unsigned long min, unsigned long max) | |||
1702 | } | 1702 | } |
1703 | 1703 | ||
1704 | /** | 1704 | /** |
1705 | * usleep_range - Drop in replacement for udelay where wakeup is flexible | 1705 | * usleep_range - Sleep for an approximate time |
1706 | * @min: Minimum time in usecs to sleep | 1706 | * @min: Minimum time in usecs to sleep |
1707 | * @max: Maximum time in usecs to sleep | 1707 | * @max: Maximum time in usecs to sleep |
1708 | * | ||
1709 | * In non-atomic context where the exact wakeup time is flexible, use | ||
1710 | * usleep_range() instead of udelay(). The sleep improves responsiveness | ||
1711 | * by avoiding the CPU-hogging busy-wait of udelay(), and the range reduces | ||
1712 | * power usage by allowing hrtimers to take advantage of an already- | ||
1713 | * scheduled interrupt instead of scheduling a new one just for this sleep. | ||
1708 | */ | 1714 | */ |
1709 | void __sched usleep_range(unsigned long min, unsigned long max) | 1715 | void __sched usleep_range(unsigned long min, unsigned long max) |
1710 | { | 1716 | { |