mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peng Huang <penghuang@google.com>
To: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	 Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	 Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	 Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	Tejun Heo <tj@kernel.org>,  David Vernet <void@manifault.com>,
	Andrea Righi <arighi@nvidia.com>,
	 Changwoo Min <changwoo@igalia.com>,
	linux-kernel@vger.kernel.org,  sched-ext@lists.linux.dev,
	Peng Huang <penghuang@google.com>,
	stable@vger.kernel.org
Subject: [PATCH] sched/pelt: Skip dormant cfs util_sum under scx_switched_all
Date: Sat, 21 Nov 2026 17:57:29 -0800	[thread overview]
Message-ID: <20261122015729.2512645-1-penghuang@google.com> (raw)

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 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().

Fixes: f0e1a0643a59 ("sched_ext: Implement BPF extensible scheduler class")
Cc: stable@vger.kernel.org
Signed-off-by: Peng Huang <penghuang@google.com>
---
 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


                 reply	other threads:[~2026-11-22  1:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261122015729.2512645-1-penghuang@google.com \
    --to=penghuang@google.com \
    --cc=arighi@nvidia.com \
    --cc=bsegall@google.com \
    --cc=changwoo@igalia.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=void@manifault.com \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®