Re: [PATCH v3] sched/fair: Avoid stale CPU util_est value for schedutil in task dequeue
From: Peter Zijlstra
Date: Fri Dec 18 2020 - 09:37:37 EST
On Fri, Dec 18, 2020 at 02:12:50PM +0100, Vincent Guittot wrote:
> On Fri, 18 Dec 2020 at 10:28, Xuewen Yan <xuewen.yan94@xxxxxxxxx> wrote:
> >
> > From: Xuewen Yan <xuewen.yan@xxxxxxxxxx>
> >
> > CPU (root cfs_rq) estimated utilization (util_est) is currently used in
> > dequeue_task_fair() to drive frequency selection before it is updated.
> >
> > with:
> >
> > CPU_util : rq->cfs.avg.util_avg
> > CPU_util_est : rq->cfs.avg.util_est
> > CPU_utilization : max(CPU_util, CPU_util_est)
> > task_util : p->se.avg.util_avg
> > task_util_est : p->se.avg.util_est
> >
> > dequeue_task_fair():
> >
> > /* (1) CPU_util and task_util update + inform schedutil about
> > CPU_utilization changes */
> > for_each_sched_entity() /* 2 loops */
> > (dequeue_entity() ->) update_load_avg() -> cfs_rq_util_change()
> > -> cpufreq_update_util() ->...-> sugov_update_[shared\|single]
> > -> sugov_get_util() -> cpu_util_cfs()
> >
> > /* (2) CPU_util_est and task_util_est update */
> > util_est_dequeue()
> >
> > cpu_util_cfs() uses CPU_utilization which could lead to a false (too
> > high) utilization value for schedutil in task ramp-down or ramp-up
> > scenarios during task dequeue.
> >
> > To mitigate the issue split the util_est update (2) into:
> >
> > (A) CPU_util_est update in util_est_dequeue()
> > (B) task_util_est update in util_est_update()
> >
> > Place (A) before (1) and keep (B) where (2) is. The latter is necessary
> > since (B) relies on task_util update in (1).
> >
>
> maybe add a
> Fixes: 7f65ea42eb00 ("sched/fair: Add util_est on top of PELT")
>
> > Signed-off-by: Xuewen Yan <xuewen.yan@xxxxxxxxxx>
> > Reviewed-by: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
>
> Reviewed-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Thanks!