time: Complete NTP adjustment threshold judging conditions
authorpang.xunlei <pang.xunlei@linaro.org>
Thu, 9 Oct 2014 07:04:31 +0000 (15:04 +0800)
committerJohn Stultz <john.stultz@linaro.org>
Fri, 21 Nov 2014 19:59:56 +0000 (11:59 -0800)
The clocksource mult-adjustment threshold is [mult-maxadj, mult+maxadj],
timekeeping_adjust() only deals with the upper threshold, but misses the
lower threshold.

This patch adds the lower threshold judging condition.

Signed-off-by: pang.xunlei <pang.xunlei@linaro.org>
[jstultz: Minor fix for > 80 char line]
Signed-off-by: John Stultz <john.stultz@linaro.org>
kernel/time/timekeeping.c

index cad61b3f6beaa2983b6dda33a2b1b23a0c444a5b..41fcbe19ccfe4443805ea4a73162cab5044c5021 100644 (file)
@@ -1403,7 +1403,8 @@ static void timekeeping_adjust(struct timekeeper *tk, s64 offset)
        }
 
        if (unlikely(tk->tkr.clock->maxadj &&
-               (tk->tkr.mult > tk->tkr.clock->mult + tk->tkr.clock->maxadj))) {
+               (abs(tk->tkr.mult - tk->tkr.clock->mult)
+                       > tk->tkr.clock->maxadj))) {
                printk_once(KERN_WARNING
                        "Adjusting %s more than 11%% (%ld vs %ld)\n",
                        tk->tkr.clock->name, (long)tk->tkr.mult,