aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2013-08-19 10:57:04 -0400
committerIngo Molnar <mingo@kernel.org>2013-09-02 02:27:40 -0400
commit10866e62e8a6907d9072f10f9a0561db0c0cf50b (patch)
treea2edd643b6221d7552b88c1322998d626c1bd50e
parent30ce5dabc92b5a349a7d9e9cf499494d230e0691 (diff)
sched/fair: Fix the sd_parent_degenerate() code
I found that on my WSM box I had a redundant domain: [ 0.949769] CPU0 attaching sched-domain: [ 0.953765] domain 0: span 0,12 level SIBLING [ 0.958335] groups: 0 (cpu_power = 587) 12 (cpu_power = 588) [ 0.964548] domain 1: span 0-5,12-17 level MC [ 0.969206] groups: 0,12 (cpu_power = 1175) 1,13 (cpu_power = 1176) 2,14 (cpu_power = 1176) 3,15 (cpu_power = 1176) 4,16 (cpu_power = 1176) 5,17 (cpu_power = 1176) [ 0.984993] domain 2: span 0-5,12-17 level CPU [ 0.989822] groups: 0-5,12-17 (cpu_power = 7055) [ 0.995049] domain 3: span 0-23 level NUMA [ 0.999620] groups: 0-5,12-17 (cpu_power = 7055) 6-11,18-23 (cpu_power = 7056) Note how domain 2 has only a single group and spans the same CPUs as domain 1. We should not keep such domains and do in fact have code to prune these. It turns out that the 'new' SD_PREFER_SIBLING flag causes this, it makes sd_parent_degenerate() fail on the CPU domain. We can easily fix this by 'ignoring' the SD_PREFER_SIBLING bit and transfering it to whatever domain ends up covering the span. With this patch the domains now look like this: [ 0.950419] CPU0 attaching sched-domain: [ 0.954454] domain 0: span 0,12 level SIBLING [ 0.959039] groups: 0 (cpu_power = 587) 12 (cpu_power = 588) [ 0.965271] domain 1: span 0-5,12-17 level MC [ 0.969936] groups: 0,12 (cpu_power = 1175) 1,13 (cpu_power = 1176) 2,14 (cpu_power = 1176) 3,15 (cpu_power = 1176) 4,16 (cpu_power = 1176) 5,17 (cpu_power = 1176) [ 0.985737] domain 2: span 0-23 level NUMA [ 0.990231] groups: 0-5,12-17 (cpu_power = 7055) 6-11,18-23 (cpu_power = 7056) Reviewed-by: Paul Turner <pjt@google.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/n/tip-ys201g4jwukj0h8xcamakxq1@git.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--kernel/sched/core.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index cf8f100433e0..4da0f4bb2ca4 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4914,7 +4914,8 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)
4914 SD_BALANCE_FORK | 4914 SD_BALANCE_FORK |
4915 SD_BALANCE_EXEC | 4915 SD_BALANCE_EXEC |
4916 SD_SHARE_CPUPOWER | 4916 SD_SHARE_CPUPOWER |
4917 SD_SHARE_PKG_RESOURCES); 4917 SD_SHARE_PKG_RESOURCES |
4918 SD_PREFER_SIBLING);
4918 if (nr_node_ids == 1) 4919 if (nr_node_ids == 1)
4919 pflags &= ~SD_SERIALIZE; 4920 pflags &= ~SD_SERIALIZE;
4920 } 4921 }
@@ -5118,6 +5119,13 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
5118 tmp->parent = parent->parent; 5119 tmp->parent = parent->parent;
5119 if (parent->parent) 5120 if (parent->parent)
5120 parent->parent->child = tmp; 5121 parent->parent->child = tmp;
5122 /*
5123 * Transfer SD_PREFER_SIBLING down in case of a
5124 * degenerate parent; the spans match for this
5125 * so the property transfers.
5126 */
5127 if (parent->flags & SD_PREFER_SIBLING)
5128 tmp->flags |= SD_PREFER_SIBLING;
5121 destroy_sched_domain(parent, cpu); 5129 destroy_sched_domain(parent, cpu);
5122 } else 5130 } else
5123 tmp = tmp->parent; 5131 tmp = tmp->parent;