Commit 4b8f573b authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki Committed by Linus Torvalds

[PATCH] TIMERS: add missing compensation for HZ == 250

Add missing compensation for (HZ == 250) != (1 << SHIFT_HZ) in
second_overflow().
Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 930fc45a
...@@ -752,6 +752,15 @@ static void second_overflow(void) ...@@ -752,6 +752,15 @@ static void second_overflow(void)
else else
time_adj += (time_adj >> 2) + (time_adj >> 5); time_adj += (time_adj >> 2) + (time_adj >> 5);
#endif #endif
#if HZ == 250
/* Compensate for (HZ==250) != (1 << SHIFT_HZ).
* Add 1.5625% and 0.78125% to get 255.85938; => only 0.05% error (p. 14)
*/
if (time_adj < 0)
time_adj -= (-time_adj >> 6) + (-time_adj >> 7);
else
time_adj += (time_adj >> 6) + (time_adj >> 7);
#endif
#if HZ == 1000 #if HZ == 1000
/* Compensate for (HZ==1000) != (1 << SHIFT_HZ). /* Compensate for (HZ==1000) != (1 << SHIFT_HZ).
* Add 1.5625% and 0.78125% to get 1023.4375; => only 0.05% error (p. 14) * Add 1.5625% and 0.78125% to get 1023.4375; => only 0.05% error (p. 14)
......
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