Skip to content

Commit 08d8c65

Browse files
vireshkrafaeljw
authored andcommitted
cpufreq: Move traces and update to policy->cur to cpufreq core
The cpufreq core handles the updates to policy->cur and recording of cpufreq trace events for all the governors except schedutil's fast switch case. Move that as well to cpufreq core for consistency and readability. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 96f60cd commit 08d8c65

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

drivers/cpufreq/cpufreq.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,17 +2068,24 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
20682068
unsigned int target_freq)
20692069
{
20702070
unsigned int freq;
2071+
int cpu;
20712072

20722073
target_freq = clamp_val(target_freq, policy->min, policy->max);
20732074
freq = cpufreq_driver->fast_switch(policy, target_freq);
20742075

20752076
if (!freq)
20762077
return 0;
20772078

2079+
policy->cur = freq;
20782080
arch_set_freq_scale(policy->related_cpus, freq,
20792081
policy->cpuinfo.max_freq);
20802082
cpufreq_stats_record_transition(policy, freq);
20812083

2084+
if (trace_cpu_frequency_enabled()) {
2085+
for_each_cpu(cpu, policy->cpus)
2086+
trace_cpu_frequency(freq, cpu);
2087+
}
2088+
20822089
return freq;
20832090
}
20842091
EXPORT_SYMBOL_GPL(cpufreq_driver_fast_switch);

kernel/sched/cpufreq_schedutil.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,11 @@ static void sugov_fast_switch(struct sugov_policy *sg_policy, u64 time,
115115
unsigned int next_freq)
116116
{
117117
struct cpufreq_policy *policy = sg_policy->policy;
118-
int cpu;
119118

120119
if (!sugov_update_next_freq(sg_policy, time, next_freq))
121120
return;
122121

123-
next_freq = cpufreq_driver_fast_switch(policy, next_freq);
124-
if (!next_freq)
125-
return;
126-
127-
policy->cur = next_freq;
128-
129-
if (trace_cpu_frequency_enabled()) {
130-
for_each_cpu(cpu, policy->cpus)
131-
trace_cpu_frequency(next_freq, cpu);
132-
}
122+
cpufreq_driver_fast_switch(policy, next_freq);
133123
}
134124

135125
static void sugov_deferred_update(struct sugov_policy *sg_policy, u64 time,

0 commit comments

Comments
 (0)