Re: [PATCH 2/2] Introduce CLOCK_MONOTONIC_RAW

From: Roman Zippel
Date: Wed Apr 02 2008 - 12:39:46 EST


Hi,

On Wed, 2 Apr 2008, John Stultz wrote:

> > + u64 raw_nsec;
> > + long raw_sec;
>
>
> So, with the raw_sec being stored in the clocksource, and there not
> being a monotonic_raw value, doesn't this mean the MONOTONIC_RAW value
> will clear to zero on clocksource changes?

It's copied during the clock change.

> > @@ -215,6 +218,8 @@ static inline void clocksource_calculate
> >
> > /* Go back from cycles -> shifted ns, this time use ntp adjused mult */
> > c->xtime_interval = (u64)c->cycle_interval * c->mult;
> > + c->raw_interval = ((u64)c->cycle_interval * c->mult_orig) <<
> > + (NTP_SCALE_SHIFT - c->shift);
> > }
>
> Could you explain further how this extra shift scaling is beneficial?

The value has a constant scale, which allows a few optimizations, e.g.
look at update_wall_time(), where the 64bit-shift and 64bit-compare
has become a simple 32bit-compare, as it's now very easy to extract the
full nanosecond part and to drop the fraction part.

> (Additionally, if we're using it for more then just NTP's shift, we
> might want to change its name).

I don't mind.

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/