public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] sched: Add scx_cpuperf_target in sched_cpu_util()
@ 2026-03-18 12:17 Xuewen Yan
  2026-03-18 12:47 ` Peter Zijlstra
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Xuewen Yan @ 2026-03-18 12:17 UTC (permalink / raw)
  To: peterz, mingo, juri.lelli, vincent.guittot, tj
  Cc: dietmar.eggemann, rostedt, bsegall, mgorman, vschneid,
	lukasz.luba, linux-kernel, rui.zhang, di.shen, ke.wang,
	xuewen.yan94

Recently, while enabling sched-ext debugging, we observed abnormal behavior
in our thermal power_allocator’s temperature control.
Through debugging, we found that the CPU util was too low, causing
the CPU frequency to remain unrestricted.

This issue stems from the fact that in the sched_cpu_util() function,
when scx is enabled, cpu_util_cfs becomes zero. As a result,
the thermal subsystem perceives an extremely low CPU utilization,
which degrades the effectiveness of the power_allocator’s control.

To address this, we propose adding scx_cpuperf_target in the sched_cpu_util()
as a replacement for cpu_util_cfs, ensuring that the thermal subsystem receives
accurate load information and restores proper control behavior.

Reported-by: Di Shen <di.shen@unisoc.com>
Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
---
 kernel/sched/fair.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index bf948db905ed..20adb6fede2a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8198,7 +8198,12 @@ unsigned long effective_cpu_util(int cpu, unsigned long util_cfs,
 
 unsigned long sched_cpu_util(int cpu)
 {
-	return effective_cpu_util(cpu, cpu_util_cfs(cpu), NULL, NULL);
+	unsigned long util = scx_cpuperf_target(cpu);
+
+	if (!scx_switched_all())
+		util += cpu_util_cfs(cpu);
+
+	return effective_cpu_util(cpu, util, NULL, NULL);
 }
 
 /*
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2026-03-24  1:33 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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   ` [PATCH] sched/cpufreq: Reorder so non-SCX is common path Christian Loehle
2026-03-19  1:08   ` [RFC PATCH] sched: Add scx_cpuperf_target in sched_cpu_util() 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox