Re: [PATCH] sched/pelt: Skip dormant cfs util_sum under scx_switched_all

From: Vincent Guittot

Date: Mon Nov 23 2026 - 05:35:06 EST


On Sun, 22 Nov 2026 at 02:57, Peng Huang <penghuang@xxxxxxxxxx> wrote:
>
> When scx_switched_all() is enabled, all fair-class tasks move to
> sched_ext, scheduler_tick() skips sched_balance_trigger(), and fair_rq
> scheduling is bypassed. As a result, rq->cfs.avg.util_sum stops updating
> and retains whatever stale load was present prior to switching to SCX.

When all tasks are moved to sched_ext, fair utilization should be 0

>
> When a CPU later goes idle, update_idle_rq_clock_pelt() still adds this
> dormant rq->cfs.avg.util_sum. If stale cfs.avg.util_sum plus active RT
> and DL util_sum reaches divider, update_idle_rq_clock_pelt() treats the
> rq as overutilized, continuously increments rq->lost_idle_time, and
> stalls rq_clock_pelt(), which in turn freezes RT and DL PELT updates.
>
> Exclude rq->cfs.avg.util_sum in update_idle_rq_clock_pelt() while
> scx_switched_all() is active so dormant CFS load cannot stall idle
> rq_clock_pelt().

This is not the right solution but a bandaid to hide the issue. When
there is not fair task, rq->cfs.avg.util_sum shoudl become null.
Please look at why it is not null.
It could be that the update stops before everything has been
propagated correctly in the task group tree

>
> Fixes: f0e1a0643a59 ("sched_ext: Implement BPF extensible scheduler class")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Peng Huang <penghuang@xxxxxxxxxx>
> ---
> kernel/sched/pelt.h | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/pelt.h b/kernel/sched/pelt.h
> index f921302dc40f..6d31e1fbd094 100644
> --- a/kernel/sched/pelt.h
> +++ b/kernel/sched/pelt.h
> @@ -138,7 +138,12 @@ static inline void update_rq_clock_pelt(struct rq *rq, s64 delta)
> static inline void update_idle_rq_clock_pelt(struct rq *rq)
> {
> u32 divider = ((LOAD_AVG_MAX - 1024) << SCHED_CAPACITY_SHIFT) - LOAD_AVG_MAX;
> - u32 util_sum = rq->cfs.avg.util_sum;
> + /*
> + * Under scx_switched_all(), CFS PELT is dormant and may stay stale;
> + * exclude it so idle CPUs do not trip lost_idle_time and freeze RT
> + * PELT.
> + */
> + u32 util_sum = scx_switched_all() ? 0 : rq->cfs.avg.util_sum;
> util_sum += rq->avg_rt.util_sum;
> util_sum += rq->avg_dl.util_sum;
>
> --
> 2.56.1.750.gf70dc682cf-goog
>