Skip to contentSkip to conversation

Removes extra checking in kernel/cpuset.c

PATCH RESEND New Rakib Mullick 1 participant 1 message Aug 1, 2008

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 Removes extra checking in kernel/cpuset.c

Frist, thanks for sending comments about the patch. Now, in this function what we're trying is to get a value for *pmask . After setting *pmask value we again call 'cpus_intersects' , then if 'cs' became NULL then a BUG_ON will be triggered from the last line of the function. As Paul Jackson mentioned about two nits , so I resend it. Hopefully my point is clear. If anything else please let me know.

Thanks a lot.

kernel/cpuset.c +8 -8
diff -upr linux-2.6.26-rc9.orig/kernel/cpuset.c linux-2.6.26-rc9/kernel/cpuset.c
@@ -282,11 +282,11 @@ static struct file_system_type cpuset_fs
 
 static void guarantee_online_cpus(const struct cpuset *cs, cpumask_t *pmask)
 {
-	while (cs && !cpus_intersects(cs->cpus_allowed, cpu_online_map))
-		cs = cs->parent;
-	if (cs)
+	if (cs) {
+		while (!cpus_intersects(cs->cpus_allowed, cpu_online_map))
+			cs = cs->parent;
 		cpus_and(*pmask, cs->cpus_allowed, cpu_online_map);
-	else
+	} else
 		*pmask = cpu_online_map;
 	BUG_ON(!cpus_intersects(*pmask, cpu_online_map));
 }
@@ -306,13 +306,13 @@ static void guarantee_online_cpus(const
 
 static void guarantee_online_mems(const struct cpuset *cs, nodemask_t *pmask)
 {
-	while (cs && !nodes_intersects(cs->mems_allowed,
+	if (cs) {
+		while (!nodes_intersects(cs->mems_allowed,
 					node_states[N_HIGH_MEMORY]))
-		cs = cs->parent;
-	if (cs)
+			cs = cs->parent;
 		nodes_and(*pmask, cs->mems_allowed,
 					node_states[N_HIGH_MEMORY]);
-	else
+	} else
 		*pmask = node_states[N_HIGH_MEMORY];
 	BUG_ON(!nodes_intersects(*pmask, node_states[N_HIGH_MEMORY]));
 }