Re: [RFC][PATCH] new timeofday core subsystem (v. A2)

From: Christoph Lameter
Date: Mon Jan 24 2005 - 18:35:56 EST


On Mon, 24 Jan 2005, john stultz wrote:

> +/* __monotonic_clock():
> + * private function, must hold system_time_lock lock when being
> + * called. Returns the monotonically increasing number of
> + * nanoseconds since the system booted (adjusted by NTP scaling)
> + */
> +static nsec_t __monotonic_clock(void)
> +{
> + nsec_t ret, ns_offset;
> + cycle_t now, delta;
> +
> + /* read timesource */
> + now = read_timesource(timesource);
> +
> + /* calculate the delta since the last clock_interrupt */
> + delta = (now - offset_base) & timesource->mask;
> +
> + /* convert to nanoseconds */
> + ns_offset = cyc2ns(timesource, delta, NULL);
> +
> + /* apply the NTP scaling */
> + ns_offset = ntp_scale(ns_offset);

The monotonic clock is the time base for the gettime and gettimeofday
functions. This means ntp_scale() is called every time that the kernel or
an application access time.

As pointed out before this will dramatically worsen the performance
compared to the current code base.

ntp_scale() also will make it difficult to implement optimized arch
specific version of function for timer access.

The fastcalls would have to be disabled on ia64 to make this work. Its
likely extremely difficult to implement a fastcall if it involves
ntp_scale().

-
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/