sched/fair: Fix sched_group_energy() to support per-cpu capacity states
sched_group_energy() was supposed to support per-cpu capacity states (DVFS), however, while fixing a hotplug issue this was broken as we bail out if there is no SD_SHARE_CAP_STATES flag set. This patch implements the hotplug race check differently and should therefore reinstate support for per-cpu capacity states. Change-Id: I5b865666c9ce833dcfa6514c574580d75aa0a195 Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
This commit is contained in:
parent
fef0112a63
commit
fc969e3bfa
1 changed files with 9 additions and 9 deletions
|
@ -5442,15 +5442,7 @@ static int sched_group_energy(struct energy_env *eenv)
|
||||||
*/
|
*/
|
||||||
sd = rcu_dereference(per_cpu(sd_scs, cpu));
|
sd = rcu_dereference(per_cpu(sd_scs, cpu));
|
||||||
|
|
||||||
if (!sd)
|
if (sd && sd->parent)
|
||||||
/*
|
|
||||||
* We most probably raced with hotplug; returning a
|
|
||||||
* wrong energy estimation is better than entering an
|
|
||||||
* infinite loop.
|
|
||||||
*/
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (sd->parent)
|
|
||||||
sg_shared_cap = sd->parent->groups;
|
sg_shared_cap = sd->parent->groups;
|
||||||
|
|
||||||
for_each_domain(cpu, sd) {
|
for_each_domain(cpu, sd) {
|
||||||
|
@ -5505,6 +5497,14 @@ static int sched_group_energy(struct energy_env *eenv)
|
||||||
|
|
||||||
} while (sg = sg->next, sg != sd->groups);
|
} while (sg = sg->next, sg != sd->groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we raced with hotplug and got an sd NULL-pointer;
|
||||||
|
* returning a wrong energy estimation is better than
|
||||||
|
* entering an infinite loop.
|
||||||
|
*/
|
||||||
|
if (cpumask_test_cpu(cpu, &visit_cpus))
|
||||||
|
return -EINVAL;
|
||||||
next_cpu:
|
next_cpu:
|
||||||
cpumask_clear_cpu(cpu, &visit_cpus);
|
cpumask_clear_cpu(cpu, &visit_cpus);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Reference in a new issue