aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/timekeeping.c
diff options
context:
space:
mode:
authorJon Hunter <jon-hunter@ti.com>2009-08-18 13:45:10 -0400
committerThomas Gleixner <tglx@linutronix.de>2009-11-13 14:46:24 -0500
commit98962465ed9e6ea99c38e0af63fe1dcb5a79dc25 (patch)
treef3f69ad8f6cd47e72a75da6de49eb3402f15cd9b /kernel/time/timekeeping.c
parent529eaccd900a59724619b4a6ef6579fd518d5218 (diff)
nohz: Prevent clocksource wrapping during idle
The dynamic tick allows the kernel to sleep for periods longer than a single tick, but it does not limit the sleep time currently. In the worst case the kernel could sleep longer than the wrap around time of the time keeping clock source which would result in losing track of time. Prevent this by limiting it to the safe maximum sleep time of the current time keeping clock source. The value is calculated when the clock source is registered. [ tglx: simplified the code a bit and massaged the commit msg ] Signed-off-by: Jon Hunter <jon-hunter@ti.com> Cc: John Stultz <johnstul@us.ibm.com> LKML-Reference: <1250617512-23567-2-git-send-email-jon-hunter@ti.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/time/timekeeping.c')
-rw-r--r--kernel/time/timekeeping.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 96b3f0dfa5dc..5d4d4239a0aa 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -478,6 +478,17 @@ int timekeeping_valid_for_hres(void)
478} 478}
479 479
480/** 480/**
481 * timekeeping_max_deferment - Returns max time the clocksource can be deferred
482 *
483 * Caller must observe xtime_lock via read_seqbegin/read_seqretry to
484 * ensure that the clocksource does not change!
485 */
486u64 timekeeping_max_deferment(void)
487{
488 return timekeeper.clock->max_idle_ns;
489}
490
491/**
481 * read_persistent_clock - Return time from the persistent clock. 492 * read_persistent_clock - Return time from the persistent clock.
482 * 493 *
483 * Weak dummy function for arches that do not yet support it. 494 * Weak dummy function for arches that do not yet support it.