Re: [PATCH] sched: Fix UCLAMP_FLAG_IDLE setting

From: Quentin Perret
Date: Wed Jun 09 2021 - 10:37:25 EST


On Wednesday 09 Jun 2021 at 14:33:39 (+0000), Quentin Perret wrote:
> The UCLAMP_FLAG_IDLE flag is set on a runqueue when dequeueing the last
> active task to maintain the last uclamp.max and prevent blocked util
> from suddenly becoming visible.
>
> However, there is an asymmetry in how the flag is set and cleared which
> can lead to having the flag set whilst there are active task on the rq.
> Specifically, the flag is set in the uclamp_rq_inc() path, which is
> called at enqueue time, but cleared in the uclamp_rq_dec_id() which is
> called both when dequeueing and task _and_ during cgroup migrations.
>
> Fix this by setting the flag in the uclamp_rq_inc_id() path to ensure
> things remain symmetrical.
>
> Reported-by: Rick Yiu <rickyiu@xxxxxxxxxx>
> Signed-off-by: Quentin Perret <qperret@xxxxxxxxxx>

Argh, and I think this wants

Fixes: e496187da710 ("sched/uclamp: Enforce last task's UCLAMP_MAX")