Thread (20 messages) flat view 20 messages, 5 authors, 12d ago

Re: [PATCH] sched/fair: Only apply cpufreq pressure where frequency is invariant

From: K Prateek Nayak <kprateek.nayak@amd.com>
Date: 2026-09-09 10:05:12
Also in: lkml

Hello Hongyan,

On 9/9/2026 9:39 AM, Hongyan Xia wrote:
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);
+	}
  
  	capped_freq = policy->max;
  
LGTM.
Thanks a ton for taking a look at the suggestion.
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help