Re: [PATCH] correct inconsistent ntp interval/tick_length usage

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: john stultz
Date: Wednesday, January 30, 2008 - 7:16 pm

On Thu, 2008-01-31 at 02:55 +0100, Roman Zippel wrote:

I'm using USER_HZ, because ntp_update_frequency() uses USER_HZ.

And my tests were run at HZ=1000.


I'm not sure I follow how having two separate and totally different
definitions of NTP_INTERVAL_LENGTH is less complicated then my last
patch.

Maybe I'm missing something from your suggestion? Or maybe could you
contribute your suggestion as a patch?

My concern is we state the accumulation interval is X ns long. Then
current_tick_length() is to return (X + ntp_adjustment), so each
accumulation interval we can keep track of the error and adjust our
interval length.

So if ntp_update_frequency() sets tick_length_base to be:

	u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ)
			<< TICK_LENGTH_SHIFT;
	second_length += (s64)CLOCK_TICK_ADJUST << TICK_LENGTH_SHIFT;
	second_length += (s64)time_freq
				<< (TICK_LENGTH_SHIFT - SHIFT_NSEC);

	tick_length_base = second_length;
	do_div(tick_length_base, NTP_INTERVAL_FREQ);


The above is basically (X + part of ntp_adjustment)

So I'm trying to calculate the X as: 

#define NTP_INTERVAL_LENGTH ((((s64)TICK_USEC*NSEC_PER_USEC*USER_HZ)+CLOCK_TICK_ADJUST)/NTP_INTERVAL_FREQ)


thanks
-john


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] correct inconsistent ntp interval/tick_length ..., Valdis.Kletnieks, (Thu Jan 24, 2:14 am)
Re: [PATCH] correct inconsistent ntp interval/tick_length ..., john stultz, (Wed Jan 30, 7:16 pm)
[PATCH] Remove obsolete CLOCK_TICK_ADJUST, Roman Zippel, (Thu Feb 28, 9:49 pm)
Re: [PATCH] Remove obsolete CLOCK_TICK_ADJUST, Ray Lee, (Thu Feb 28, 11:25 pm)
Re: [PATCH] Remove obsolete CLOCK_TICK_ADJUST, Roman Zippel, (Fri Feb 29, 6:31 am)
Re: [PATCH] correct inconsistent ntp interval/tick_length ..., Jörg-Volker Peetz, (Fri Feb 29, 11:54 am)
Re: [PATCH] Remove obsolete CLOCK_TICK_ADJUST, Andrew Morton, (Fri Feb 29, 3:08 pm)
Re: [PATCH] Remove obsolete CLOCK_TICK_ADJUST, Roman Zippel, (Fri Feb 29, 3:27 pm)
Re: [PATCH] Remove obsolete CLOCK_TICK_ADJUST, Andrew Morton, (Fri Feb 29, 3:38 pm)
Re: [PATCH] Remove obsolete CLOCK_TICK_ADJUST, john stultz, (Fri Feb 29, 4:11 pm)
Re: [PATCH] Remove obsolete CLOCK_TICK_ADJUST, john stultz, (Fri Feb 29, 4:11 pm)
Re: [PATCH] Remove obsolete CLOCK_TICK_ADJUST, Roman Zippel, (Sat Mar 1, 9:03 pm)