Skip to content

Commit

Permalink
[PATCH] TIMERS: add missing compensation for HZ == 250
Browse files Browse the repository at this point in the history
Add missing compensation for (HZ == 250) != (1 << SHIFT_HZ) in
second_overflow().

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
YOSHIFUJI Hideaki authored and Linus Torvalds committed Oct 30, 2005
1 parent 930fc45 commit 4b8f573
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kernel/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,15 @@ static void second_overflow(void)
else
time_adj += (time_adj >> 2) + (time_adj >> 5);
#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
/* Compensate for (HZ==1000) != (1 << SHIFT_HZ).
* Add 1.5625% and 0.78125% to get 1023.4375; => only 0.05% error (p. 14)
Expand Down

0 comments on commit 4b8f573

Please sign in to comment.