sched: Reverse the topology list
In order to get rid of static sched_domain::level assignments, reverse the topology iteration. Signed-off-by: Peter 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.876506131@chello.nl Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
2c402dc3bb
commit
d069b916f7
@@ -7114,20 +7114,23 @@ static const struct cpumask *cpu_smt_mask(int cpu)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Topology list, bottom-up.
|
||||||
|
*/
|
||||||
static struct sched_domain_topology_level default_topology[] = {
|
static struct sched_domain_topology_level default_topology[] = {
|
||||||
#ifdef CONFIG_NUMA
|
#ifdef CONFIG_SCHED_SMT
|
||||||
{ sd_init_ALLNODES, cpu_allnodes_mask, },
|
{ sd_init_SIBLING, cpu_smt_mask, },
|
||||||
{ sd_init_NODE, cpu_node_mask, },
|
|
||||||
#endif
|
|
||||||
{ sd_init_CPU, cpu_cpu_mask, },
|
|
||||||
#ifdef CONFIG_SCHED_BOOK
|
|
||||||
{ sd_init_BOOK, cpu_book_mask, },
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_SCHED_MC
|
#ifdef CONFIG_SCHED_MC
|
||||||
{ sd_init_MC, cpu_coregroup_mask, },
|
{ sd_init_MC, cpu_coregroup_mask, },
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_SCHED_SMT
|
#ifdef CONFIG_SCHED_BOOK
|
||||||
{ sd_init_SIBLING, cpu_smt_mask, },
|
{ sd_init_BOOK, cpu_book_mask, },
|
||||||
|
#endif
|
||||||
|
{ sd_init_CPU, cpu_cpu_mask, },
|
||||||
|
#ifdef CONFIG_NUMA
|
||||||
|
{ sd_init_NODE, cpu_node_mask, },
|
||||||
|
{ sd_init_ALLNODES, cpu_allnodes_mask, },
|
||||||
#endif
|
#endif
|
||||||
{ NULL, },
|
{ NULL, },
|
||||||
};
|
};
|
||||||
@@ -7136,18 +7139,18 @@ static struct sched_domain_topology_level *sched_domain_topology = default_topol
|
|||||||
|
|
||||||
struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl,
|
struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl,
|
||||||
struct s_data *d, const struct cpumask *cpu_map,
|
struct s_data *d, const struct cpumask *cpu_map,
|
||||||
struct sched_domain_attr *attr, struct sched_domain *parent,
|
struct sched_domain_attr *attr, struct sched_domain *child,
|
||||||
int cpu)
|
int cpu)
|
||||||
{
|
{
|
||||||
struct sched_domain *sd = tl->init(d, cpu);
|
struct sched_domain *sd = tl->init(d, cpu);
|
||||||
if (!sd)
|
if (!sd)
|
||||||
return parent;
|
return child;
|
||||||
|
|
||||||
set_domain_attribute(sd, attr);
|
set_domain_attribute(sd, attr);
|
||||||
cpumask_and(sched_domain_span(sd), cpu_map, tl->mask(cpu));
|
cpumask_and(sched_domain_span(sd), cpu_map, tl->mask(cpu));
|
||||||
sd->parent = parent;
|
if (child)
|
||||||
if (parent)
|
child->parent = sd;
|
||||||
parent->child = sd;
|
sd->child = child;
|
||||||
|
|
||||||
return sd;
|
return sd;
|
||||||
}
|
}
|
||||||
@@ -7176,6 +7179,9 @@ static int build_sched_domains(const struct cpumask *cpu_map,
|
|||||||
for (tl = sched_domain_topology; tl->init; tl++)
|
for (tl = sched_domain_topology; tl->init; tl++)
|
||||||
sd = build_sched_domain(tl, &d, cpu_map, attr, sd, i);
|
sd = build_sched_domain(tl, &d, cpu_map, attr, sd, i);
|
||||||
|
|
||||||
|
while (sd->child)
|
||||||
|
sd = sd->child;
|
||||||
|
|
||||||
*per_cpu_ptr(d.sd, i) = sd;
|
*per_cpu_ptr(d.sd, i) = sd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user