Commit 5a643352 authored by Yang Honggang (Joseph)'s avatar Yang Honggang (Joseph) Committed by Greg Kroah-Hartman

clocksource: Fix bug with max_deferment margin calculation

commit b1f91966 upstream.

In order to leave a margin of 12.5% we should >> 3 not >> 5.
Signed-off-by: default avatarYang Honggang (Joseph) <eagle.rtlinux@gmail.com>
[jstultz: Modified commit subject]
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3e31d12f
...@@ -550,7 +550,7 @@ static u64 clocksource_max_deferment(struct clocksource *cs) ...@@ -550,7 +550,7 @@ static u64 clocksource_max_deferment(struct clocksource *cs)
* note a margin of 12.5% is used because this can be computed with * note a margin of 12.5% is used because this can be computed with
* a shift, versus say 10% which would require division. * a shift, versus say 10% which would require division.
*/ */
return max_nsecs - (max_nsecs >> 5); return max_nsecs - (max_nsecs >> 3);
} }
#ifndef CONFIG_ARCH_USES_GETTIMEOFFSET #ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
...@@ -671,7 +671,7 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq) ...@@ -671,7 +671,7 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq)
* ~ 0.06ppm granularity for NTP. We apply the same 12.5% * ~ 0.06ppm granularity for NTP. We apply the same 12.5%
* margin as we do in clocksource_max_deferment() * margin as we do in clocksource_max_deferment()
*/ */
sec = (cs->mask - (cs->mask >> 5)); sec = (cs->mask - (cs->mask >> 3));
do_div(sec, freq); do_div(sec, freq);
do_div(sec, scale); do_div(sec, scale);
if (!sec) if (!sec)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment