]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] TIMERS: add missing compensation for HZ == 250
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Sun, 30 Oct 2005 01:15:42 +0000 (18:15 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 30 Oct 2005 04:40:35 +0000 (21:40 -0700)
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>
kernel/timer.c

index 3ba10fa35b607fd8a3c6d0db86f104c767df6604..6a2e5f8dc725ffea0b73bb60036838b6ca628c5f 100644 (file)
@@ -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)