Re: [RFC] HZ free ntp

From: Roman Zippel
Date: Wed Dec 13 2006 - 08:59:01 EST


Hi,

On Tue, 12 Dec 2006, john stultz wrote:

> Basically INTERVAL_LENGTH_NSEC defines the NTP interval length that the
> time code will use to accumulate with. In this patch I've pushed it out
> to a full second, but it could be set via config (NSEC_PER_SEC/HZ for
> regular systems, something larger for systems using dynticks).

Why do you want to use such an interval? This makes everything only more
complicated.
The largest possible interval is freq cycles (or 1 second without
adjustments). That is the base interval and without redesigning NTP we
can't change that. This base interval can be subdivided into smaller
intervals for incremental updates.
You cannot choose arbitrary intervals otherwise you get other problems,
e.g. with your patch time_offset handling is broken.

> + /* calculate the length of one NTP adjusted second */
> + second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ);
> + second_length += (s64)CLOCK_TICK_ADJUST;
> + adj_length = (s64)time_freq;
> +
> + /* calculate tick length @ HZ*/
> + tick_length = (second_length << TICK_LENGTH_SHIFT)
> + + (adj_length << (TICK_LENGTH_SHIFT - SHIFT_NSEC));
> + do_div(tick_length, HZ);
> + tick_nsec = tick_length >> TICK_LENGTH_SHIFT;
> +
> +
> + /* calculate interval_length_base */
> + /* XXX - this is broken up to avoid 64bit overlfows */
> + interval_length_base = second_length * INTERVAL_LENGTH_NSEC;
> + interval_length_base <<= 2;
> + do_div(interval_length_base, NSEC_PER_SEC);
> + interval_length_base <<= TICK_LENGTH_SHIFT-2;

You don't have to introduce anything new, it's tick_length that changes
and HZ that becomes a variable in this function.

bye, Roman
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/