Skip to content

Commit 599457b

Browse files
vingu-linaroingomolnar
authored andcommitted
cpufreq: Use the fixed and coherent frequency for scaling capacity
cpuinfo.max_freq can change at runtime because of boost as an example. This implies that the value could be different from the frequency that has been used to compute the capacity of a CPU. The new arch_scale_freq_ref() returns a fixed and coherent frequency that can be used to compute the capacity for a given frequency. [ Also fix a arch_set_freq_scale() newline style wart in <linux/cpufreq.h>. ] Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Tested-by: Lukasz Luba <lukasz.luba@arm.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Link: https://lore.kernel.org/r/20231211104855.558096-3-vincent.guittot@linaro.org
1 parent 9942cb2 commit 599457b

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/cpufreq/cpufreq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy,
454454

455455
arch_set_freq_scale(policy->related_cpus,
456456
policy->cur,
457-
policy->cpuinfo.max_freq);
457+
arch_scale_freq_ref(policy->cpu));
458458

459459
spin_lock(&policy->transition_lock);
460460
policy->transition_ongoing = false;
@@ -2174,7 +2174,7 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
21742174

21752175
policy->cur = freq;
21762176
arch_set_freq_scale(policy->related_cpus, freq,
2177-
policy->cpuinfo.max_freq);
2177+
arch_scale_freq_ref(policy->cpu));
21782178
cpufreq_stats_record_transition(policy, freq);
21792179

21802180
if (trace_cpu_frequency_enabled()) {

include/linux/cpufreq.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,7 @@ void arch_set_freq_scale(const struct cpumask *cpus,
12031203
{
12041204
}
12051205
#endif
1206+
12061207
/* the following are really really optional */
12071208
extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
12081209
extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs;

0 commit comments

Comments
 (0)