From: Hongyan Xia <hongyan.xia@transsion.com>
To: K Prateek Nayak <kprateek.nayak@amd.com>,
jong wu <jianyong.wu@outlook.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"zhongyuan@hygon.cn" <zhongyuan@hygon.cn>,
"huangsj@hygon.cn" <huangsj@hygon.cn>,
Vincent Guittot <vincent.guittot@linaro.org>,
"Rafael J . Wysocki" <rafael@kernel.org>
Subject: Re: [PATCH] sched/fair: Only apply cpufreq pressure where frequency is invariant
Date: Wed, 9 Sep 2026 04:09:46 +0000 [thread overview]
Message-ID: <a9dc111b-21cb-4bcb-ac91-f6be04bc2e06@transsion.com> (raw)
In-Reply-To: <4e39e935-2339-442b-8b14-a688b605c35e@amd.com>
On 9/7/2026 4:37 PM, K Prateek Nayak wrote:
> On 9/7/2026 1:37 PM, K Prateek Nayak wrote:
>> So, I've been trying to understand these bits and looking at
>> cpufreq_policy_init_qos(), the "policy->cpuinfo.max_freq" should be the
>> frequency including the boost range but I see cpufreq_update_pressure()
>> and it says:
>>
>> max_freq = arch_scale_freq_ref(cpu);
>> if (!max_freq)
>> max_freq = policy->cpuinfo.max_freq;
>>
>> capped_freq = policy->max;
>>
>> /*
>> * Handle properly the boost frequencies, which should simply clean
>> * the cpufreq pressure value.
>> */
>> if (max_freq <= capped_freq) {
>> ...
>> }
>>
>>
>> Looking at this, I feel "policy->cpuinfo.max_freq" should not include
>> the boost frequency, or x86 should implement a arch_scale_freq_ref()
>> to know when boost is enabled vs disabled.
>>
>> If cpufreq_update_pressure() indeed has to disregard boost frequency,
>> and anything above P0 is not considered as pressure, we can simply
>> do:
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index b898b6544069..068e6d6e15a1 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -2586,8 +2586,11 @@ static void cpufreq_update_pressure(struct cpufreq_policy *policy)
>>
>> cpu = cpumask_first(policy->related_cpus);
>> max_freq = arch_scale_freq_ref(cpu);
>> - if (!max_freq)
>> - max_freq = policy->cpuinfo.max_freq;
>> + if (!max_freq) {
>> + max_freq = __resolve_freq(policy, policy->cpuinfo.max_freq,
>> + policy->max, policy->min,
>
> My bad, that should have been other way around and use the cpuinfo
> fields to prevent capping based on policy limits. Updated diff:
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index b898b6544069..97f4a3ba5107 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2586,8 +2586,11 @@ static void cpufreq_update_pressure(struct cpufreq_policy *policy)
>
> cpu = cpumask_first(policy->related_cpus);
> max_freq = arch_scale_freq_ref(cpu);
> - if (!max_freq)
> - max_freq = policy->cpuinfo.max_freq;
> + if (!max_freq) {
> + max_freq = __resolve_freq(policy, policy->cpuinfo.max_freq,
> + policy->cpuinfo.min_freq, policy->cpuinfo.max_freq,
> + CPUFREQ_RELATION_H);
> + }
>
> capped_freq = policy->max;
>
LGTM.
NIT: I do wonder if we need a full __resolve_freq() each time. We could
cache the highest achievable OPP on max_freq updates, but that's future
optimization.
> ---
> [...]
next prev parent reply other threads:[~2026-09-09 4:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 7:39 Jianyong Wu
2026-08-21 9:26 ` Vincent Guittot
2026-08-24 3:44 ` Hongyan Xia
2026-08-24 13:06 ` Jianyong Wu
2026-08-25 7:40 ` Hongyan Xia
2026-09-02 9:00 ` jong wu
2026-08-25 13:05 ` Vincent Guittot
2026-09-02 8:49 ` jong wu
2026-09-02 9:37 ` Hongyan Xia
2026-09-03 2:04 ` jong wu
2026-09-07 2:32 ` Hongyan Xia
2026-09-07 8:07 ` K Prateek Nayak
2026-09-07 8:37 ` K Prateek Nayak
2026-09-08 7:19 ` jong wu
2026-09-09 4:09 ` Hongyan Xia [this message]
2026-09-09 10:04 ` K Prateek Nayak
2026-09-10 8:05 ` Vincent Guittot
2026-09-10 11:59 ` Jianyong Wu
2026-09-12 7:11 ` Jianyong Wu
2026-09-07 14:57 ` jong wu
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=a9dc111b-21cb-4bcb-ac91-f6be04bc2e06@transsion.com \
--to=hongyan.xia@transsion.com \
--cc=dietmar.eggemann@arm.com \
--cc=huangsj@hygon.cn \
--cc=jianyong.wu@outlook.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=zhongqiu.han@oss.qualcomm.com \
--cc=zhongyuan@hygon.cn \
/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®