From: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
To: rafael@kernel.org, viresh.kumar@linaro.org, mingo@redhat.com,
peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
bsegall@google.com, mgorman@suse.de, vschneid@redhat.com
Cc: linux-pm@vger.kernel.org,
Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Subject: [PATCH] sched/cpufreq: Fix capacity calc in shared policy update
Date: Tue, 25 Nov 2025 08:54:37 +0530 [thread overview]
Message-ID: <20251125032437.2056626-1-kaushlendra.kumar@intel.com> (raw)
In sugov_next_freq_shared(), the CPU capacity is retrieved only
for the CPU that triggered the update (sg_cpu->cpu) and then
incorrectly applied to all CPUs in the shared frequency domain
during the loop.On heterogeneous systems with CPUs of different
capacities sharing a frequency domain, this causes incorrect
frequency selection.
Calculate per-CPU capacity in the loop and track maximum across
all CPUs for proper frequency calculation.
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
kernel/sched/cpufreq_schedutil.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 0ab5f9d4bc59..9fdbc7a6063d 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -492,15 +492,15 @@ static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu, u64 time)
{
struct sugov_policy *sg_policy = sg_cpu->sg_policy;
struct cpufreq_policy *policy = sg_policy->policy;
- unsigned long util = 0, max_cap;
+ unsigned long util = 0, max_cap = 0;
unsigned int j;
- max_cap = arch_scale_cpu_capacity(sg_cpu->cpu);
-
for_each_cpu(j, policy->cpus) {
struct sugov_cpu *j_sg_cpu = &per_cpu(sugov_cpu, j);
- unsigned long boost;
+ unsigned long boost, j_max_cap;
+ j_max_cap = arch_scale_cpu_capacity(j);
+ max_cap = max(max_cap, j_max_cap);
boost = sugov_iowait_apply(j_sg_cpu, time, max_cap);
sugov_get_util(j_sg_cpu, boost);
--
2.34.1
next reply other threads:[~2025-11-25 3:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 3:24 Kaushlendra Kumar [this message]
2025-11-25 8:37 ` [PATCH] sched/cpufreq: Fix capacity calc in shared policy update Christian Loehle
2025-11-25 9:28 ` Kumar, Kaushlendra
2025-11-25 9:04 ` Lukasz Luba
2025-11-25 9:23 ` Kumar, Kaushlendra
2025-11-25 9:38 ` Vincent Guittot
2025-11-25 9:46 ` Christian Loehle
2025-11-25 9:57 ` Vincent Guittot
2025-11-25 12:41 ` Rafael J. Wysocki
2025-11-25 14:05 ` Kumar, Kaushlendra
2025-11-25 12:09 ` Rafael J. Wysocki
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=20251125032437.2056626-1-kaushlendra.kumar@intel.com \
--to=kaushlendra.kumar@intel.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-pm@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--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