diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-04-07 08:10:00 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-04-11 08:09:26 -0400 |
commit | eb7a74e6cd936c00749e2921b9e058631d986648 (patch) | |
tree | 3efb7b3d2560a4121226900edb433c7f2c50684c /kernel/sched.c | |
parent | d3081f52f29da1ba6c27685519a9222b39eac763 (diff) |
sched: Stuff the sched_domain creation in a data-structure
In order to make the topology contruction fully dynamic, remove the
still hard-coded list of possible domains and stick them in a
data-structure.
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.770335383@chello.nl
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 3ae1e023f3f0..f0e1821dcb96 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -6843,6 +6843,16 @@ enum s_alloc { | |||
6843 | sa_none, | 6843 | sa_none, |
6844 | }; | 6844 | }; |
6845 | 6845 | ||
6846 | typedef struct sched_domain *(*sched_domain_build_f)(struct s_data *d, | ||
6847 | const struct cpumask *cpu_map, struct sched_domain_attr *attr, | ||
6848 | struct sched_domain *parent, int cpu); | ||
6849 | |||
6850 | typedef const struct cpumask *(*sched_domain_mask_f)(int cpu); | ||
6851 | |||
6852 | struct sched_domain_topology_level { | ||
6853 | sched_domain_build_f build; | ||
6854 | }; | ||
6855 | |||
6846 | /* | 6856 | /* |
6847 | * Assumes the sched_domain tree is fully constructed | 6857 | * Assumes the sched_domain tree is fully constructed |
6848 | */ | 6858 | */ |
@@ -7185,6 +7195,18 @@ static struct sched_domain *__build_smt_sched_domain(struct s_data *d, | |||
7185 | return sd; | 7195 | return sd; |
7186 | } | 7196 | } |
7187 | 7197 | ||
7198 | static struct sched_domain_topology_level default_topology[] = { | ||
7199 | { __build_allnodes_sched_domain, }, | ||
7200 | { __build_node_sched_domain, }, | ||
7201 | { __build_cpu_sched_domain, }, | ||
7202 | { __build_book_sched_domain, }, | ||
7203 | { __build_mc_sched_domain, }, | ||
7204 | { __build_smt_sched_domain, }, | ||
7205 | { NULL, }, | ||
7206 | }; | ||
7207 | |||
7208 | static struct sched_domain_topology_level *sched_domain_topology = default_topology; | ||
7209 | |||
7188 | /* | 7210 | /* |
7189 | * Build sched domains for a given set of cpus and attach the sched domains | 7211 | * Build sched domains for a given set of cpus and attach the sched domains |
7190 | * to the individual cpus | 7212 | * to the individual cpus |
@@ -7203,13 +7225,11 @@ static int build_sched_domains(const struct cpumask *cpu_map, | |||
7203 | 7225 | ||
7204 | /* Set up domains for cpus specified by the cpu_map. */ | 7226 | /* Set up domains for cpus specified by the cpu_map. */ |
7205 | for_each_cpu(i, cpu_map) { | 7227 | for_each_cpu(i, cpu_map) { |
7228 | struct sched_domain_topology_level *tl; | ||
7229 | |||
7206 | sd = NULL; | 7230 | sd = NULL; |
7207 | sd = __build_allnodes_sched_domain(&d, cpu_map, attr, sd, i); | 7231 | for (tl = sched_domain_topology; tl->build; tl++) |
7208 | sd = __build_node_sched_domain(&d, cpu_map, attr, sd, i); | 7232 | sd = tl->build(&d, cpu_map, attr, sd, i); |
7209 | sd = __build_cpu_sched_domain(&d, cpu_map, attr, sd, i); | ||
7210 | sd = __build_book_sched_domain(&d, cpu_map, attr, sd, i); | ||
7211 | sd = __build_mc_sched_domain(&d, cpu_map, attr, sd, i); | ||
7212 | sd = __build_smt_sched_domain(&d, cpu_map, attr, sd, i); | ||
7213 | 7233 | ||
7214 | *per_cpu_ptr(d.sd, i) = sd; | 7234 | *per_cpu_ptr(d.sd, i) = sd; |
7215 | } | 7235 | } |