From: Christian Loehle <christian.loehle@arm.com>
To: Peter Zijlstra <peterz@infradead.org>,
Xuewen Yan <xuewen.yan@unisoc.com>,
Vincent Guittot <vincent.guittot@linaro.org>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
vincent.guittot@linaro.org, tj@kernel.org,
dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
lukasz.luba@arm.com, linux-kernel@vger.kernel.org,
rui.zhang@intel.com, di.shen@unisoc.com, ke.wang@unisoc.com,
xuewen.yan94@gmail.com
Subject: [PATCH] sched/cpufreq: Reorder so non-SCX is common path
Date: Wed, 18 Mar 2026 13:03:47 +0000 [thread overview]
Message-ID: <9459fb8c-ec11-4bd3-806c-b864493096e8@arm.com> (raw)
In-Reply-To: <20260318124718.GC3738786@noisy.programming.kicks-ass.net>
scx_enabled() with sugov is probably the rarer case to fair with
sugov, so reorder the condition into scx_enabled() check instead of
the !scx_switched_all() check so the static branch is not checked when
sched_ext isn't enabled.
No functional change intended.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
---
@Peter
We probably also want the analogous reorder in sugov then....
kernel/sched/cpufreq_schedutil.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 153232dd8276..06bd453a37eb 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -225,10 +225,16 @@ unsigned long sugov_effective_cpu_perf(int cpu, unsigned long actual,
static void sugov_get_util(struct sugov_cpu *sg_cpu, unsigned long boost)
{
- unsigned long min, max, util = scx_cpuperf_target(sg_cpu->cpu);
+ unsigned long min, max, util = cpu_util_cfs_boost(sg_cpu->cpu);
- if (!scx_switched_all())
- util += cpu_util_cfs_boost(sg_cpu->cpu);
+ if (scx_enabled()) {
+ unsigned long scx_util = scx_cpuperf_target(sg_cpu->cpu);
+
+ if (!scx_switched_all())
+ scx_util += util;
+
+ util = scx_util;
+ }
util = effective_cpu_util(sg_cpu->cpu, util, &min, &max);
util = max(util, boost);
sg_cpu->bw_min = min;
--
2.34.1
next prev parent reply other threads:[~2026-03-18 13:03 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 12:17 [RFC PATCH] sched: Add scx_cpuperf_target in sched_cpu_util() Xuewen Yan
2026-03-18 12:47 ` Peter Zijlstra
2026-03-18 12:55 ` Vincent Guittot
2026-03-18 13:44 ` Qais Yousef
2026-03-19 2:13 ` Xuewen Yan
2026-03-19 7:09 ` Vincent Guittot
2026-03-19 10:18 ` Lukasz Luba
2026-03-24 1:32 ` Qais Yousef
2026-03-18 13:03 ` Christian Loehle [this message]
2026-03-19 1:08 ` Tejun Heo
2026-03-19 2:24 ` Xuewen Yan
2026-03-19 2:38 ` Xuewen Yan
2026-03-19 9:02 ` Peter Zijlstra
2026-03-19 10:01 ` Uros Bizjak
2026-03-19 10:26 ` Peter Zijlstra
2026-03-19 11:02 ` Uros Bizjak
2026-03-19 11:12 ` Peter Zijlstra
2026-03-19 11:19 ` Uros Bizjak
2026-03-19 11:33 ` Peter Zijlstra
2026-03-19 11:22 ` Peter Zijlstra
2026-03-18 12:54 ` Christian Loehle
2026-03-19 1:21 ` Tejun Heo
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=9459fb8c-ec11-4bd3-806c-b864493096e8@arm.com \
--to=christian.loehle@arm.com \
--cc=bsegall@google.com \
--cc=di.shen@unisoc.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=ke.wang@unisoc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=rui.zhang@intel.com \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=xuewen.yan94@gmail.com \
--cc=xuewen.yan@unisoc.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®