mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hongyan Xia <hongyan.xia@transsion.com>
To: Jianyong Wu <wujianyong@hygon.cn>, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Juri Lelli <juri.lelli@redhat.com>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jianyong.wu@outlook.com" <jianyong.wu@outlook.com>,
	"zhongyuan@hygon.cn" <zhongyuan@hygon.cn>,
	"huangsj@hygon.cn" <huangsj@hygon.cn>
Subject: Re: [PATCH] sched/fair: Only apply cpufreq pressure where frequency is invariant
Date: Mon, 24 Aug 2026 03:44:14 +0000	[thread overview]
Message-ID: <fea033f4-a680-445f-b231-2a0cc1dded8b@transsion.com> (raw)
In-Reply-To: <20260821073927.455475-1-wujianyong@hygon.cn>

On 8/21/2026 3:39 PM, Jianyong Wu wrote:
> cpufreq pressure lowers a CPU's capacity by the ratio between the highest
> frequency it may reach and the highest one it can reach right now.
> Utilization carries the matching scaling only where the architecture is
> frequency invariant; without it a fully busy CPU accumulates the whole
> SCHED_CAPACITY_SCALE whatever frequency it runs at.

Given how PELT works, anything that is always-running without idle time 
under PELT will reach 1024 eventually regardless of invariance.

> Reducing capacity on such a system scales one side of the comparison and
> not the other, and a fully busy CPU ends up reporting more utilization
> than it is credited with being able to run.

Sorry I didn't quite catch what 'comparison' means, and it's fairly 
normal for task and CPU utilization to exceed capacity w/ or w/o 
invariance. We just manually cap it to CPU capacity in a few places. 
Could you be more specific on what the problem is?

> This became reachable with commit d2d5c129d07e ("cpufreq: Make
> cpufreq_update_pressure() fall back to cpuinfo.max_freq"); before it the
> pressure was always zero there. Whether that matters depends on frequency
> invariance rather than on the fallback itself: a system that has it scales
> both sides and is unaffected, while a system that does not scales only the
> capacity.
> 
> Fixes: d2d5c129d07e ("cpufreq: Make cpufreq_update_pressure() fall back to cpuinfo.max_freq")
> Signed-off-by: Jianyong Wu <wujianyong@hygon.cn>
> ---
>   kernel/sched/fair.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index c19a025d8d68..a163e00c9882 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5854,10 +5854,17 @@ static inline void util_est_dequeue(struct cfs_rq *cfs_rq,
>   static inline unsigned long get_actual_cpu_capacity(int cpu)
>   {
>   	unsigned long capacity = arch_scale_cpu_capacity(cpu);
> +	unsigned long pressure = hw_load_avg(cpu_rq(cpu));
>   
> -	capacity -= max(hw_load_avg(cpu_rq(cpu)), cpufreq_get_pressure(cpu));
> +	/*
> +	 * Utilization only follows frequency where the architecture is
> +	 * frequency invariant. Elsewhere, lowering the capacity would
> +	 * scale one side of the comparison and not the other.
> +	 */
> +	if (arch_scale_freq_invariant())
> +		pressure = max(pressure, cpufreq_get_pressure(cpu));
>   
> -	return capacity;
> +	return capacity - pressure;
>   }
>   
>   static inline int util_fits_cpu(unsigned long util,


  parent reply	other threads:[~2026-08-24  3:44 UTC|newest]

Thread overview: 6+ 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 [this message]
2026-08-24 13:06   ` Jianyong Wu
2026-08-25  7:40     ` Hongyan Xia
2026-08-25 13:05     ` Vincent Guittot

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=fea033f4-a680-445f-b231-2a0cc1dded8b@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=wujianyong@hygon.cn \
    --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®