aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2008-11-05 20:45:16 -0500
committerIngo Molnar <mingo@elte.hu>2008-11-07 02:29:57 -0500
commitf29c9b1ccb52904ee442a933cf3dee628f9f4e62 (patch)
tree836b4383a89a5aac64e50afd752a48b4bb0c167a /kernel
parent4bab0ea1d42dd1927af9df6fbf0003fc00617c50 (diff)
sched: fix a bug in sched domain degenerate
Impact: re-add incorrectly eliminated sched domain layers (1) on i386 with SCHED_SMT and SCHED_MC enabled # mount -t cgroup -o cpuset xxx /mnt # echo 0 > /mnt/cpuset.sched_load_balance # mkdir /mnt/0 # echo 0 > /mnt/0/cpuset.cpus # dmesg CPU0 attaching sched-domain: domain 0: span 0 level CPU groups: 0 (2) on i386 with SCHED_MC enabled but SCHED_SMT disabled # same with (1) # dmesg CPU0 attaching NULL sched-domain. The bug is that some sched domains may be skipped unintentionally when degenerating (optimizing) sched domains. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 82cc839c9210..4c7e2bcdfa89 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6877,15 +6877,17 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
6877 struct sched_domain *tmp; 6877 struct sched_domain *tmp;
6878 6878
6879 /* Remove the sched domains which do not contribute to scheduling. */ 6879 /* Remove the sched domains which do not contribute to scheduling. */
6880 for (tmp = sd; tmp; tmp = tmp->parent) { 6880 for (tmp = sd; tmp; ) {
6881 struct sched_domain *parent = tmp->parent; 6881 struct sched_domain *parent = tmp->parent;
6882 if (!parent) 6882 if (!parent)
6883 break; 6883 break;
6884
6884 if (sd_parent_degenerate(tmp, parent)) { 6885 if (sd_parent_degenerate(tmp, parent)) {
6885 tmp->parent = parent->parent; 6886 tmp->parent = parent->parent;
6886 if (parent->parent) 6887 if (parent->parent)
6887 parent->parent->child = tmp; 6888 parent->parent->child = tmp;
6888 } 6889 } else
6890 tmp = tmp->parent;
6889 } 6891 }
6890 6892
6891 if (sd && sd_degenerate(sd)) { 6893 if (sd && sd_degenerate(sd)) {