summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCon Kolivas <kernel@kolivas.org>2016-11-04 09:11:58 +1100
committerCon Kolivas <kernel@kolivas.org>2016-11-04 10:25:11 +1100
commit412d7f42bf6eb6d65f5ad99528125f3e1db45fe9 (patch)
treed1d6ddff564299fa07b366a873af5ac1838dde5c
parent3e95f34f4ea7d617928cc5cb4cd1121b66a467bd (diff)
Special case only schedule_timeouts of 1 to use highres timeouts of 1ms.
-rw-r--r--kernel/time/timer.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 07f4a4e3238f..3c567c56fea8 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1514,34 +1514,16 @@ signed long __sched schedule_timeout(signed long timeout)
expire = timeout + jiffies;
-#if defined(CONFIG_SCHED_MUQSS)
- /*
- * Use high resolution timers in place of regular ones whenever possible
- * on muqss since they are mandatory and low Hz is recommended.
- */
- if (likely(hrtimer_resolution < NSEC_PER_SEC / HZ)) {
- int delta, secs;
- ktime_t expires;
-
- if (!timeout) {
- current->state = TASK_RUNNING;
- goto out;
- }
- secs = timeout / HZ;
- delta = timeout % HZ;
- delta *= NSEC_PER_SEC / HZ;
+ if (timeout == 1 && hrtimer_resolution < NSEC_PER_SEC / HZ) {
/*
- * Round down half a tick to match what it would have been on
- * average with regular tick based timers.
+ * Special case 1 as being a request for the minimum timeout
+ * and use highres timers to timeout after 1ms to workaround
+ * the granularity of low Hz tick timers.
*/
- delta -= NSEC_PER_SEC / HZ / 2;
- expires = ktime_set(secs, delta);
- if (schedule_hrtimeout(&expires, HRTIMER_MODE_REL_PINNED) == -EINTR)
- goto out_timeout;
- timeout = 0;
- goto out;
+ if (!schedule_min_hrtimeout())
+ return 0;
+ goto out_timeout;
}
-#endif
setup_timer_on_stack(&timer, process_timeout, (unsigned long)current);
__mod_timer(&timer, expire, false, TIMER_NOT_PINNED);