Commit a9c9a9b6 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

sched: Simplify sched_groups_power initialization

Again, instead of relying on knowing the possible domains and their
order, simply rely on the sched_domain tree and whatever domains are
present in there to initialize the sched_group cpu_power.

Note: we need to iterate the CPU mask backwards because of the
cpumask_first() condition for iterating up the tree. By iterating the
mask backwards we ensure all groups of a domain are set-up before
starting on the parent groups that rely on its children to be
completely done.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20110407122942.187335414@chello.nlSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 21d42ccf
...@@ -7334,43 +7334,14 @@ static int __build_sched_domains(const struct cpumask *cpu_map, ...@@ -7334,43 +7334,14 @@ static int __build_sched_domains(const struct cpumask *cpu_map,
} }
/* Calculate CPU power for physical packages and nodes */ /* Calculate CPU power for physical packages and nodes */
#ifdef CONFIG_SCHED_SMT for (i = nr_cpumask_bits-1; i >= 0; i--) {
for_each_cpu(i, cpu_map) { if (!cpumask_test_cpu(i, cpu_map))
sd = &per_cpu(cpu_domains, i).sd; continue;
init_sched_groups_power(i, sd);
}
#endif
#ifdef CONFIG_SCHED_MC
for_each_cpu(i, cpu_map) {
sd = &per_cpu(core_domains, i).sd;
init_sched_groups_power(i, sd);
}
#endif
#ifdef CONFIG_SCHED_BOOK
for_each_cpu(i, cpu_map) {
sd = &per_cpu(book_domains, i).sd;
init_sched_groups_power(i, sd);
}
#endif
for_each_cpu(i, cpu_map) {
sd = &per_cpu(phys_domains, i).sd;
init_sched_groups_power(i, sd);
}
#ifdef CONFIG_NUMA
for_each_cpu(i, cpu_map) {
sd = &per_cpu(node_domains, i).sd;
init_sched_groups_power(i, sd);
}
if (d.sd_allnodes) { sd = *per_cpu_ptr(d.sd, i);
for_each_cpu(i, cpu_map) { for (; sd; sd = sd->parent)
sd = &per_cpu(allnodes_domains, i).sd;
init_sched_groups_power(i, sd); init_sched_groups_power(i, sd);
} }
}
#endif
/* Attach the domains */ /* Attach the domains */
for_each_cpu(i, cpu_map) { for_each_cpu(i, cpu_map) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment