From: tip-bot for Bjorn Helgaas <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, john.stultz@linaro.org, hpa@zytor.com,
bhelgaas@google.com, linux-kernel@vger.kernel.org,
tglx@linutronix.de
Subject: [tip:timers/core] timers: Clarify usleep_range() function comment
Date: Thu, 9 Jun 2016 16:03:41 -0700 [thread overview]
Message-ID: <tip-b5227d03b7191a9a44bf75a4c228a6a9ddbe781b@git.kernel.org> (raw)
In-Reply-To: <20160531212302.28502.44995.stgit@bhelgaas-glaptop2.roam.corp.google.com>
Commit-ID: b5227d03b7191a9a44bf75a4c228a6a9ddbe781b
Gitweb: http://git.kernel.org/tip/b5227d03b7191a9a44bf75a4c228a6a9ddbe781b
Author: Bjorn Helgaas <bhelgaas@google.com>
AuthorDate: Tue, 31 May 2016 16:23:02 -0500
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 10 Jun 2016 00:59:14 +0200
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>
---
kernel/time/timer.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 3a95f97..67dd610 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)
}
/**
- * usleep_range - Drop in replacement for udelay where wakeup is flexible
+ * usleep_range - Sleep for an approximate time
* @min: Minimum time in usecs to sleep
* @max: Maximum time in usecs to sleep
+ *
+ * In non-atomic context where the exact wakeup time is flexible, use
+ * usleep_range() instead of udelay(). The sleep improves responsiveness
+ * by avoiding the CPU-hogging busy-wait of udelay(), and the range reduces
+ * power usage by allowing hrtimers to take advantage of an already-
+ * scheduled interrupt instead of scheduling a new one just for this sleep.
*/
void __sched usleep_range(unsigned long min, unsigned long max)
{
prev parent reply other threads:[~2016-06-09 23:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 21:23 [PATCH] " Bjorn Helgaas
2016-06-09 23:03 ` tip-bot for Bjorn Helgaas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-b5227d03b7191a9a44bf75a4c228a6a9ddbe781b@git.kernel.org \
--to=tipbot@zytor.com \
--cc=bhelgaas@google.com \
--cc=hpa@zytor.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®