From d10689b68aff7b48e3de1a3f7fcd6567bd2905af Mon Sep 17 00:00:00 2001 From: Paul Jackson Date: Tue, 23 Aug 2005 01:04:27 -0700 Subject: [PATCH] cpu_exclusive sched domains on partial nodes temp fix This keeps the kernel/cpuset.c routine update_cpu_domains() from invoking the sched.c routine partition_sched_domains() if the cpuset in question doesn't fall on node boundaries. I have boot tested this on an SN2, and with the help of a couple of ad hoc printk's, determined that it does indeed avoid calling the partition_sched_domains() routine on partial nodes. I did not directly verify that this avoids setting up bogus sched domains or avoids the oops that Hawkes saw. This patch imposes a silent artificial constraint on which cpusets can be used to define dynamic sched domains. This patch should allow proceeding with this new feature in 2.6.13 for the configurations in which it is useful (node alligned sched domains) while avoiding trying to setup sched domains in the less useful cases that can cause the kernel corruption and oops. Signed-off-by: Paul Jackson Acked-by: Ingo Molnar Acked-by: Dinakar Guniguntala Acked-by: John Hawkes Signed-off-by: Linus Torvalds --- kernel/cpuset.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'kernel') diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 21a4e3b2cbda..e0d296c5b302 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -635,6 +635,23 @@ static void update_cpu_domains(struct cpuset *cur) if (par == NULL || cpus_empty(cur->cpus_allowed)) return; + /* + * Hack to avoid 2.6.13 partial node dynamic sched domain bug. + * Require the 'cpu_exclusive' cpuset to include all (or none) + * of the CPUs on each node, or return w/o changing sched domains. + * Remove this hack when dynamic sched domains fixed. + */ + { + int i, j; + + for_each_cpu_mask(i, cur->cpus_allowed) { + for_each_cpu_mask(j, node_to_cpumask(cpu_to_node(i))) { + if (!cpu_isset(j, cur->cpus_allowed)) + return; + } + } + } + /* * Get all cpus from parent's cpus_allowed not part of exclusive * children -- cgit From 3725822f7c7134249addcd4549aff086950c8090 Mon Sep 17 00:00:00 2001 From: Paul Jackson Date: Wed, 24 Aug 2005 04:15:10 -0700 Subject: [PATCH] cpu_exclusive sched domains build fix As reported by Paul Mackerras , the previous patch "cpu_exclusive sched domains fix" broke the ppc64 build with CONFIC_CPUSET, yielding error messages: kernel/cpuset.c: In function 'update_cpu_domains': kernel/cpuset.c:648: error: invalid lvalue in unary '&' kernel/cpuset.c:648: error: invalid lvalue in unary '&' On some arch's, the node_to_cpumask() is a function, returning a cpumask_t. But the for_each_cpu_mask() requires an lvalue mask. The following patch fixes this build failure by making a copy of the cpumask_t on the stack. Signed-off-by: Paul Jackson Signed-off-by: Linus Torvalds --- kernel/cpuset.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'kernel') diff --git a/kernel/cpuset.c b/kernel/cpuset.c index e0d296c5b302..d7f4d0c95737 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -645,7 +645,9 @@ static void update_cpu_domains(struct cpuset *cur) int i, j; for_each_cpu_mask(i, cur->cpus_allowed) { - for_each_cpu_mask(j, node_to_cpumask(cpu_to_node(i))) { + cpumask_t mask = node_to_cpumask(cpu_to_node(i)); + + for_each_cpu_mask(j, mask) { if (!cpu_isset(j, cur->cpus_allowed)) return; } -- cgit