diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-04-07 08:09:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-04-11 08:09:24 -0400 |
commit | d3081f52f29da1ba6c27685519a9222b39eac763 (patch) | |
tree | 5968de6895d304c0762b6c5788bb892bb6bdd2e3 /kernel/sched.c | |
parent | 4cb988395da6e16627a8be69729e50cd72ebb23e (diff) |
sched: Create proper cpu_$DOM_mask() functions
In order to unify the sched domain creation more, create proper
cpu_$DOM_mask() functions for those domains that didn't already have
one.
Use the sched_domains_tmpmask for the weird NUMA domain span.
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.717702108@chello.nl
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 35fc9959b564..3ae1e023f3f0 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -6807,8 +6807,22 @@ static void sched_domain_node_span(int node, struct cpumask *span) | |||
6807 | cpumask_or(span, span, cpumask_of_node(next_node)); | 6807 | cpumask_or(span, span, cpumask_of_node(next_node)); |
6808 | } | 6808 | } |
6809 | } | 6809 | } |
6810 | |||
6811 | static const struct cpumask *cpu_node_mask(int cpu) | ||
6812 | { | ||
6813 | lockdep_assert_held(&sched_domains_mutex); | ||
6814 | |||
6815 | sched_domain_node_span(cpu_to_node(cpu), sched_domains_tmpmask); | ||
6816 | |||
6817 | return sched_domains_tmpmask; | ||
6818 | } | ||
6810 | #endif /* CONFIG_NUMA */ | 6819 | #endif /* CONFIG_NUMA */ |
6811 | 6820 | ||
6821 | static const struct cpumask *cpu_cpu_mask(int cpu) | ||
6822 | { | ||
6823 | return cpumask_of_node(cpu_to_node(cpu)); | ||
6824 | } | ||
6825 | |||
6812 | int sched_smt_power_savings = 0, sched_mc_power_savings = 0; | 6826 | int sched_smt_power_savings = 0, sched_mc_power_savings = 0; |
6813 | 6827 | ||
6814 | struct sd_data { | 6828 | struct sd_data { |
@@ -7088,7 +7102,7 @@ static struct sched_domain *__build_allnodes_sched_domain(struct s_data *d, | |||
7088 | #ifdef CONFIG_NUMA | 7102 | #ifdef CONFIG_NUMA |
7089 | sd = sd_init_ALLNODES(d, i); | 7103 | sd = sd_init_ALLNODES(d, i); |
7090 | set_domain_attribute(sd, attr); | 7104 | set_domain_attribute(sd, attr); |
7091 | cpumask_copy(sched_domain_span(sd), cpu_map); | 7105 | cpumask_and(sched_domain_span(sd), cpu_map, cpu_possible_mask); |
7092 | sd->parent = parent; | 7106 | sd->parent = parent; |
7093 | if (parent) | 7107 | if (parent) |
7094 | parent->child = sd; | 7108 | parent->child = sd; |
@@ -7104,8 +7118,7 @@ static struct sched_domain *__build_node_sched_domain(struct s_data *d, | |||
7104 | #ifdef CONFIG_NUMA | 7118 | #ifdef CONFIG_NUMA |
7105 | sd = sd_init_NODE(d, i); | 7119 | sd = sd_init_NODE(d, i); |
7106 | set_domain_attribute(sd, attr); | 7120 | set_domain_attribute(sd, attr); |
7107 | sched_domain_node_span(cpu_to_node(i), sched_domain_span(sd)); | 7121 | cpumask_and(sched_domain_span(sd), cpu_map, cpu_node_mask(i)); |
7108 | cpumask_and(sched_domain_span(sd), sched_domain_span(sd), cpu_map); | ||
7109 | sd->parent = parent; | 7122 | sd->parent = parent; |
7110 | if (parent) | 7123 | if (parent) |
7111 | parent->child = sd; | 7124 | parent->child = sd; |
@@ -7120,8 +7133,7 @@ static struct sched_domain *__build_cpu_sched_domain(struct s_data *d, | |||
7120 | struct sched_domain *sd; | 7133 | struct sched_domain *sd; |
7121 | sd = sd_init_CPU(d, i); | 7134 | sd = sd_init_CPU(d, i); |
7122 | set_domain_attribute(sd, attr); | 7135 | set_domain_attribute(sd, attr); |
7123 | cpumask_and(sched_domain_span(sd), | 7136 | cpumask_and(sched_domain_span(sd), cpu_map, cpu_cpu_mask(i)); |
7124 | cpumask_of_node(cpu_to_node(i)), cpu_map); | ||
7125 | sd->parent = parent; | 7137 | sd->parent = parent; |
7126 | if (parent) | 7138 | if (parent) |
7127 | parent->child = sd; | 7139 | parent->child = sd; |