2008-08-01 03:21:39

by Rakib Mullick

[permalink] [raw]
Subject: [RESEND][PATCH] 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.

Signed-off-by: Md.Rakib H. Mullick ([email protected])

diff -upr linux-2.6.26-rc9.orig/kernel/cpuset.c linux-2.6.26-rc9/kernel/cpuset.c
--- linux-2.6.26-rc9.orig/kernel/cpuset.c 2008-08-01 08:38:41.000000000 +0600
+++ linux-2.6.26-rc9/kernel/cpuset.c 2008-08-01 08:33:37.000000000 +0600
@@ -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]));
}