Re: [PATCH] sched/fair: Only apply cpufreq pressure where frequency is invariant
From: Vincent Guittot <vincent.guittot@linaro.org>
Date: 2026-09-10 08:05:32
Also in:
lkml
On Wed, 9 Sept 2026 at 12:05, K Prateek Nayak [off-list ref] wrote:
Hello Hongyan, On 9/9/2026 9:39 AM, Hongyan Xia wrote:quoted
quoted
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);
As long as the reference frequency used in cpufreq_update_pressure remains fixed whetever boost is enabled or not this is ok. We don't want the pressure to change when boost is enabled or disabled only when policy->max changes.
quoted
quoted
+ } capped_freq = policy->max;LGTM.Thanks a ton for taking a look at the suggestion.quoted
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.Sure! We can cache it in the policy object during cpufreq_policy_online(). Jianyong Wu would like to take a stab at it? If not, I can send it out early next week. -- Thanks and Regards, Prateek Disclaimer: Hygon emails are routed differently in our organization. Response might be slightly delayed until my NNTP rule finds the email. Sorry for any inconvenience.