From: John Stultz Date: Tue, 18 Sep 2012 01:38:46 +0000 (-0400) Subject: time: Avoid making adjustments if we haven't accumulated anything X-Git-Tag: v2.6.34.14~75 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b4e2564c9f5ba83af10076d029a7507b7a33b870;p=thirdparty%2Fkernel%2Fstable.git time: Avoid making adjustments if we haven't accumulated anything commit bf2ac312195155511a0f79325515cbb61929898a upstream. If update_wall_time() is called and the current offset isn't large enough to accumulate, avoid re-calling timekeeping_adjust which may change the clock freq and can cause 1ns inconsistencies with CLOCK_REALTIME_COARSE/CLOCK_MONOTONIC_COARSE. Signed-off-by: John Stultz Cc: Prarit Bhargava Cc: Ingo Molnar Link: http://lkml.kernel.org/r/1345595449-34965-5-git-send-email-john.stultz@linaro.org Signed-off-by: Thomas Gleixner Cc: Linux Kernel Signed-off-by: John Stultz Signed-off-by: Paul Gortmaker --- diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 0d59077c3fe80..bbdad71aa90f5 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -849,6 +849,10 @@ void update_wall_time(void) #else offset = timekeeper.cycle_interval; #endif + /* Check if there's really nothing to do */ + if (offset < timekeeper.cycle_interval) + return; + timekeeper.xtime_nsec = (s64)xtime.tv_nsec << timekeeper.shift; /*