From: "pang.xunlei" <pang.xun...@linaro.org>

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.

Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Arnd Bergmann <arnd.bergm...@linaro.org>
Cc: pang.xunlei <pang.xun...@linaro.org>
Cc: Miroslav Lichvar <mlich...@redhat.com>
Cc: Richard Cochran <richardcoch...@gmail.com>
Cc: Prarit Bhargava <pra...@redhat.com>
Cc: Alessandro Zummo <a.zu...@towertech.it>
Signed-off-by: pang.xunlei <pang.xun...@linaro.org>
[jstultz: Minor fix for > 80 char line]
Signed-off-by: John Stultz <john.stu...@linaro.org>
---
 kernel/time/timekeeping.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index cad61b3..41fcbe1 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -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,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to