Re: [PATCH] sched: Folding nohz load accounting more accurate

From: Peter Zijlstra
Date: Tue Jun 19 2012 - 05:57:43 EST


On Tue, 2012-06-19 at 14:24 +0800, Charles Wang wrote:
> > +static inline int calc_load_write_idx(void)
> > {
> > + int idx = calc_load_idx;
> > +
> > + /*
> > + * See calc_global_nohz(), if we observe the new index, we also
> > + * need to observe the new update time.
> > + */
> > + smp_rmb();
> > +
> > + /*
> > + * If the folding window started, make sure we start writing in the
> > + * next idle-load delta.
> > + */
> > + if (!time_before(jiffies, calc_load_update))
> > + idx++;
>
> Can we just take calc_load_update as the start time-line here? Will
> there be different ticks between cpus?

I'm not exactly sure what you're asking, but yes and probably yes.

The per-cpu ticks are separate, but on the same time-line. That is, they
don't happen at the exact same moment, either due to per-cpu IRQ
disabling or because the architecture spreads the tick. But they do all
get HZ ticks per second.

Remember, jiffies is a global timeline, and the global calc_load_update
is the last to be moved fwd to the next period, so its ideally suited to
be used to determine the current window.
--
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/