missing #if for 1000 HZ
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line · Andrew Morton
Guys?
If I understand what is being done, he is right. By this measure the current error in the div (by shifting) is 2.4%.
I wonder how this plays with(line 639):
time_phase += time_adj;
if (time_phase <= -FINENSEC) {
long ltemp = -time_phase >> (SHIFT_SCALE - 10);
time_phase += ltemp << (SHIFT_SCALE - 10);
delta_nsec -= ltemp;
}where, we are also using >>10 ~= /1000. I _think_ this ladder approximation only delays part of the correction but does not loose it, but the more eyes the better.
-g
Quoted 36 lines
Begin forwarded message:
Date: 22 Jul 2003 21:01:16 -0400
From: Albert Cahalan <[email protected]>
To: [email protected], [email protected]
Cc: Andrew Morton <[email protected]>, [email protected]
Subject: missing #if for 1000 HZThis should improve timekeeping a bit @ 1000 HZ.
diff -Naurd
old/kernel/timer.cnew/kernel/timer.ckernel/timer.c +9
-0@@ -606,6 +606,15 @@ else time_adj += (time_adj >> 2) + (time_adj >> 5);#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) +*/ +if (time_adj <0 ) + time_adj -= (-time_adj >>6 ) + (-time_adj >>7 ); +else + time_adj += (time_adj >>6 ) + (time_adj >>7 ); +#endif }/* in the NTP reference this is called "hardclock()" */
Signature · 3 lines
George Anzinger [email protected] High-res-timers: http://sourceforge.net/projects/high-res-timers/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml