Skip to content

Commit d62d813

Browse files
credprafaeljw
authored andcommitted
cpufreq: schedutil: Examine the correct CPU when we update util
After commit 674e754 (sched: cpufreq: Allow remote cpufreq callbacks) we stopped to always read the utilization for the CPU we are running the governor on, and instead we read it for the CPU which we've been told has updated utilization. This is stored in sugov_cpu->cpu. The value is set in sugov_register() but we clear it in sugov_start() which leads to always looking at the utilization of CPU0 instead of the correct one. Fix this by consolidating the initialization code into sugov_start(). Fixes: 674e754 (sched: cpufreq: Allow remote cpufreq callbacks) Signed-off-by: Chris Redpath <[email protected]> Reviewed-by: Patrick Bellasi <[email protected]> Reviewed-by: Brendan Jackman <[email protected]> Acked-by: Viresh Kumar <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 0b07194 commit d62d813

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

kernel/sched/cpufreq_schedutil.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,7 @@ static int sugov_start(struct cpufreq_policy *policy)
649649
struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu);
650650

651651
memset(sg_cpu, 0, sizeof(*sg_cpu));
652+
sg_cpu->cpu = cpu;
652653
sg_cpu->sg_policy = sg_policy;
653654
sg_cpu->flags = SCHED_CPUFREQ_RT;
654655
sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq;
@@ -714,11 +715,6 @@ struct cpufreq_governor *cpufreq_default_governor(void)
714715

715716
static int __init sugov_register(void)
716717
{
717-
int cpu;
718-
719-
for_each_possible_cpu(cpu)
720-
per_cpu(sugov_cpu, cpu).cpu = cpu;
721-
722718
return cpufreq_register_governor(&schedutil_gov);
723719
}
724720
fs_initcall(sugov_register);

0 commit comments

Comments
 (0)