Re: [PATCH 1/2] sched/fair: keep load_avg and load_sum synced
From: Peter Zijlstra
Date: Thu May 27 2021 - 09:37:39 EST
On Thu, May 27, 2021 at 03:18:35PM +0200, Vincent Guittot wrote:
> > - delta_sum = load_sum - (s64)se_weight(se) * se->avg.load_sum;
> > - delta_avg = load_avg - se->avg.load_avg;
> > -
> > se->avg.load_sum = runnable_sum;
> > se->avg.load_avg = load_avg;
> > - add_positive(&cfs_rq->avg.load_avg, delta_avg);
> > - add_positive(&cfs_rq->avg.load_sum, delta_sum);
> > +
> > + add_positive(&cfs_rq->avg.load_avg, (long)(load_avg - se->avg.load_avg));
>
> you have to keep:
> delta_avg = load_avg - se->avg.load_avg
> or move se->avg.load_avg = load_avg after
> add_positive(&cfs_rq->avg.load_avg, ..);
> because otherwise (load_avg - se->avg.load_avg) == 0
Duh. /me goes fix.