summaryrefslogtreecommitdiffstats
path: root/kernel/timer.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2005-10-30 02:15:42 +0100
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 05:40:35 +0100
commit4b8f573b5db02a3017afbba49026a6aef480174f (patch)
tree4abf19125526809d4be44cb83373f85605854575 /kernel/timer.c
parent[PATCH] vmalloc_node (diff)
downloadlinux-4b8f573b5db02a3017afbba49026a6aef480174f.tar.xz
linux-4b8f573b5db02a3017afbba49026a6aef480174f.zip
[PATCH] TIMERS: add missing compensation for HZ == 250
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>
Diffstat (limited to '')
-rw-r--r--kernel/timer.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/timer.c b/kernel/timer.c
index 3ba10fa35b60..6a2e5f8dc725 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -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)