From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-Id: <20111207161223.237098362@clark.kroah.org> Date: Wed, 07 Dec 2011 08:12:45 -0800 From: Greg KH To: , Cc: , , , "Yang Honggang (Joseph)" , John Stultz Subject: [103/104] clocksource: Fix bug with max_deferment margin calculation In-Reply-To: <20111207161246.GA10995@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: 3.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Yang Honggang (Joseph)" commit b1f919664d04a8d0ba29cb76673c7ca3325a2006 upstream. In order to leave a margin of 12.5% we should >> 3 not >> 5. Signed-off-by: Yang Honggang (Joseph) [jstultz: Modified commit subject] Signed-off-by: John Stultz Signed-off-by: Greg Kroah-Hartman --- kernel/time/clocksource.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -550,7 +550,7 @@ static u64 clocksource_max_deferment(str * note a margin of 12.5% is used because this can be computed with * 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 @@ -671,7 +671,7 @@ void __clocksource_updatefreq_scale(stru * ~ 0.06ppm granularity for NTP. We apply the same 12.5% * 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, scale); if (!sec)