From: Lukasz Luba <lukasz.luba@arm.com>
To: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Cc: linux-pm@vger.kernel.org, rafael@kernel.org, vschneid@redhat.com,
mgorman@suse.de, dietmar.eggemann@arm.com, juri.lelli@redhat.com,
peterz@infradead.org, viresh.kumar@linaro.org, mingo@redhat.com,
vincent.guittot@linaro.org, bsegall@google.com
Subject: Re: [PATCH] sched/cpufreq: Fix capacity calc in shared policy update
Date: Tue, 25 Nov 2025 09:04:30 +0000 [thread overview]
Message-ID: <71ea7728-6808-4bdf-9437-3746ff8664fc@arm.com> (raw)
In-Reply-To: <20251125032437.2056626-1-kaushlendra.kumar@intel.com>
Hi Kaushlendra,
On 11/25/25 03:24, Kaushlendra Kumar wrote:
> 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.
How is this possible?
Is it old or new Intel SoC (a chip name would be also welcome)?
I would like to hear Rafael's view on such platform configuration.
It looks like a hack and the next needed step would be a similar
hack to calm down EAS and EM in the energy estimation code...
Do we really want to support such configuration in the generic code?
>
> Calculate per-CPU capacity in the loop and track maximum across
> all CPUs for proper frequency calculation.
I've changed that loop to speed-up the hot code path triggered
from the scheduler. For most platforms (till now) it's fine
to get the cpu capacity once for all cpus in the policy.
A lot of code is based on this assumption.
>
> 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);
>
My gut feeling tells me that it won't be the last needed code change
if we go that path...
Regards,
Lukasz
next prev parent reply other threads:[~2025-11-25 9:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 3:24 [PATCH] sched/cpufreq: Fix capacity calc in shared policy update Kaushlendra Kumar
2025-11-25 8:37 ` Christian Loehle
2025-11-25 9:28 ` Kumar, Kaushlendra
2025-11-25 9:04 ` Lukasz Luba [this message]
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=71ea7728-6808-4bdf-9437-3746ff8664fc@arm.com \
--to=lukasz.luba@arm.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kaushlendra.kumar@intel.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