Re: [RFC] time: xtime_lock is held too long

Andi Kleen
2011-05-06T16:59:15Z

On Fri, May 06, 2011 at 12:18:27PM +0200, Thomas Gleixner wrote:
> > There's actually some potential here. I got a moderate speedup in a
> > database benchmark with this patch recently. The biggest win
>
> Numbers please.

Low single digit on a hard to improve well tuned workload.

> Well, then we should make sure that they are not.

Ok I will send a patch.

>
> And looking at a few kernel images the interesting variables
> timekeeper, xtime, wall_to_monotonic are in a consecutive area which
> is not really surprising. Further all images have xtime and
> wall_to_monotonic in the same cacheline, just xtime_lock is somewhere
> else.

I guess it depends a lot on the particular alignment.
But yes it should be ensured.

>
> > (needs some cleanups, just for illustration)
>
> And how's that cleanup going to look like? Making the timekeeping
> internal variables global again is not going to happen. And if you

Why not? You could of course call some function in the file
to do the prefetches, but that would seem dumb to me.

> want prefetching those variables in the timer interrupt, then you want
> to prefetch them in any random code path which ends up touching them.

If that code path shows up in profiling. Only the timer interrupt
did so far.

> That's the completely wrong aproach, really. If stuff takes too long,
> then we need to tackle it at the root of the problem and not solve it
> by sprinkling magic prefetches all over the place.

If you have a better way to make it faster please share it.

-Andi