Re: [PATCH] cpumask: alloc blank cpumask left over

From: Yinghai Lu
Date: Fri Jun 05 2009 - 13:58:00 EST


It seems we could remove that FIXME now.
cpumask_size is referred rather later.

Subject: [PATCH] use nr_cpumask_bits for cpumask_size calculating

so alloc_cpusmask_var could save some space when MAXSMP is used aka NR_CPUS
is 4096 on small conf system

Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>

---
include/linux/cpumask.h | 4 +---
lib/cpumask.c | 8 --------
2 files changed, 1 insertion(+), 11 deletions(-)

Index: linux-2.6/include/linux/cpumask.h
===================================================================
--- linux-2.6.orig/include/linux/cpumask.h
+++ linux-2.6/include/linux/cpumask.h
@@ -996,9 +996,7 @@ static inline int cpulist_parse(const ch
*/
static inline size_t cpumask_size(void)
{
- /* FIXME: Once all cpumask assignments are eliminated, this
- * can be nr_cpumask_bits */
- return BITS_TO_LONGS(NR_CPUS) * sizeof(long);
+ return BITS_TO_LONGS(nr_cpumask_bits) * sizeof(long);
}

/*
Index: linux-2.6/lib/cpumask.c
===================================================================
--- linux-2.6.orig/lib/cpumask.c
+++ linux-2.6/lib/cpumask.c
@@ -100,14 +100,6 @@ bool alloc_cpumask_var_node(cpumask_var_
dump_stack();
}
#endif
- /* FIXME: Bandaid to save us from old primitives which go to NR_CPUS. */
- if (*mask) {
- unsigned char *ptr = (unsigned char *)cpumask_bits(*mask);
- unsigned int tail;
- tail = BITS_TO_LONGS(NR_CPUS - nr_cpumask_bits) * sizeof(long);
- memset(ptr + cpumask_size() - tail, 0, tail);
- }
-
return *mask != NULL;
}
EXPORT_SYMBOL(alloc_cpumask_var_node);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/