---
 mm/allocpercpu.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

Index: linux-2.6/mm/allocpercpu.c
===================================================================
--- linux-2.6.orig/mm/allocpercpu.c	2007-10-30 22:12:43.000000000 -0700
+++ linux-2.6/mm/allocpercpu.c	2007-10-30 22:12:56.000000000 -0700
@@ -9,15 +9,14 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 
-#define MAXIMUM_UNITS_PER_CPU 8192
+#define PER_CPU_ALLOC_SIZE 32768
+#define UNITS_PER_CPU (PER_CPU_ALLOC_SIZE / sizeof(int))
 
-#define FREE 0
-#define END 1
-#define USED 2
+enum unit_type { FREE, END, USED };
 
 static DEFINE_SPINLOCK(cpu_area_lock);
-static u8 cpu_alloc_map[MAXIMUM_UNITS_PER_CPU] = { 1, };
-DEFINE_PER_CPU(int, cpu_area)[MAXIMUM_UNITS_PER_CPU];
+static u8 cpu_alloc_map[UNITS_PER_CPU] = { 1, };
+DEFINE_PER_CPU(int, cpu_area)[UNITS_PER_CPU];
 EXPORT_PER_CPU_SYMBOL(cpu_area);
 
 static inline int size_to_units(unsigned long size)
@@ -53,14 +52,14 @@ static inline void *cpu_alloc(unsigned l
 
 	spin_lock(&cpu_area_lock);
 	do {
-		while (start < MAXIMUM_UNITS_PER_CPU &&
+		while (start < UNITS_PER_CPU &&
 				cpu_alloc_map[start] != FREE)
 			start++;
-		if (start == MAXIMUM_UNITS_PER_CPU)
+		if (start == UNITS_PER_CPU)
 			return NULL;
 
 		end = start + 1;
-		while (end < MAXIMUM_UNITS_PER_CPU && end - start < units &&
+		while (end < UNITS_PER_CPU && end - start < units &&
 				cpu_alloc_map[end] == FREE)
 			end++;
 		if (end - start == units)
@@ -80,7 +79,7 @@ static inline void cpu_free(void *pcpu)
 	int units;
 
 	BUG_ON(cpu_alloc_map[start] == FREE ||
-			start >= MAXIMUM_UNITS_PER_CPU);
+			start >= UNITS_PER_CPU);
 
 	spin_lock(&cpu_area_lock);
 	units = clear_map(start);