summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorCon Kolivas <kernel@kolivas.org>2016-11-04 09:25:54 +1100
committerCon Kolivas <kernel@kolivas.org>2016-11-04 10:24:03 +1100
commit4f6fa3e2c8b9d422f25711bc884106a1f4ae1131 (patch)
tree62e30f17cdb3e57a9ec402899c462b670689f6ae /kernel
parent82fae03257861febd782b48b3f37ae03401962a5 (diff)
Convert msleep to use hrtimers when active.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/timer.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index cd067bc72d0d..7651d47e7975 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1887,7 +1887,13 @@ void __init init_timers(void)
*/
void msleep(unsigned int msecs)
{
- unsigned long timeout = msecs_to_jiffies(msecs) + 1;
+ unsigned long timeout;
+
+ if (likely(hrtimer_resolution < NSEC_PER_SEC / HZ)) {
+ while (msecs)
+ msecs = schedule_msec_hrtimeout_uninterruptible(msecs);
+ }
+ timeout = msecs_to_jiffies(msecs) + 1;
while (timeout)
timeout = schedule_timeout_uninterruptible(timeout);
@@ -1901,7 +1907,14 @@ EXPORT_SYMBOL(msleep);
*/
unsigned long msleep_interruptible(unsigned int msecs)
{
- unsigned long timeout = msecs_to_jiffies(msecs) + 1;
+ unsigned long timeout;
+
+ if (likely(hrtimer_resolution < NSEC_PER_SEC / HZ)) {
+ while (msecs && !signal_pending(current))
+ msecs = schedule_msec_hrtimeout_interruptible(msecs);
+ return msecs;
+ }
+ timeout = msecs_to_jiffies(msecs) + 1;
while (timeout && !signal_pending(current))
timeout = schedule_timeout_interruptible(timeout);