--- include/linux/percpu.h | 2 +- mm/cpu_alloc.c | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) Index: linux-2.6/mm/cpu_alloc.c =================================================================== --- linux-2.6.orig/mm/cpu_alloc.c 2008-01-28 22:26:47.888590207 -0800 +++ linux-2.6/mm/cpu_alloc.c 2008-01-28 22:26:47.904589494 -0800 @@ -58,8 +58,7 @@ static unsigned long cpu_alloc_start = ( unsigned long cpu_alloc_end; /* - * Basic allocation unit. This also defines the basic alignment - * of boottime allocations. + * Basic allocation unit. Defines the granularity of the allocator. */ #define UNIT_SIZE sizeof(int) @@ -75,7 +74,7 @@ static int size_to_units(unsigned long s * Lock to protect the bitmap and the meta data for the cpu allocator. */ static DEFINE_SPINLOCK(cpu_alloc_map_lock); -static unsigned long units; +static unsigned long total_units; static unsigned long *cpu_alloc_map; void * __init boot_cpu_alloc(unsigned long size, unsigned long align) @@ -139,8 +138,8 @@ void *cpu_alloc(unsigned long size, gfp_ for ( ; ; ) { - start = find_next_zero_bit(cpu_alloc_map, units, start); - if (start >= units) + start = find_next_zero_bit(cpu_alloc_map, total_units, start); + if (start >= total_units) goto out_of_memory; if (first) @@ -151,7 +150,7 @@ void *cpu_alloc(unsigned long size, gfp_ * the starting unit. */ if (start % (align / UNIT_SIZE) == 0 && - find_next_bit(cpu_alloc_map, units, start + 1) >= + find_next_bit(cpu_alloc_map, total_units, start + 1) >= start + units) break; start++; @@ -161,7 +160,7 @@ void *cpu_alloc(unsigned long size, gfp_ if (first) first_free = start + units; - if (start + units > units) + if (start + units > total_units) goto out_of_memory; set_map(start, units); @@ -200,7 +199,7 @@ void cpu_free(void *start, unsigned long BUG_ON(p < cpu_alloc_start); index = (p - cpu_alloc_start) / UNIT_SIZE; BUG_ON(!test_bit(index, cpu_alloc_map) || - index >= units); + index >= total_units); spin_lock_irqsave(&cpu_alloc_map_lock, flags); @@ -216,7 +215,7 @@ EXPORT_SYMBOL(cpu_free); /* * Setup cpu_alloc. All boot time boot_cpu_alloc() must have been completed. */ -void cpu_alloc_init(void) +void __init cpu_alloc_init(void) { unsigned long size; unsigned long reserve; @@ -228,10 +227,11 @@ void cpu_alloc_init(void) cpu_alloc_end = PERCPU_ENOUGH_ROOM; size = cpu_alloc_end - reserve; - units = size_to_units(size); - cpu_alloc_map = alloc_bootmem(units * UNIT_SIZE); + total_units = size_to_units(size); + cpu_alloc_map = alloc_bootmem(total_units * UNIT_SIZE); cpu_alloc_start = per_cpu_start + reserve; - printk("CPU_ALLOC: size=%lu reserved=%lu static=%u unitsize=%u units=%lu\n", - cpu_alloc_end, reserve, __per_cpu_size, UNIT_SIZE, units); + printk("CPU_ALLOC: size=%lu avail=%lu boot=%lu static=%tu unit=%tu units=%lu\n", + cpu_alloc_end, total_units * UNIT_SIZE, reserve - __per_cpu_size, + __per_cpu_size, UNIT_SIZE, total_units); } Index: linux-2.6/include/linux/percpu.h =================================================================== --- linux-2.6.orig/include/linux/percpu.h 2008-01-28 22:26:47.888590207 -0800 +++ linux-2.6/include/linux/percpu.h 2008-01-28 22:33:52.739133265 -0800 @@ -168,7 +168,7 @@ static inline void percpu_free(void *__p * handled from an interrupt context). */ -#define CPU_PTR(__p, __cpu) percpu_ptr((__p), (__cpu)) +#define CPU_PTR(__p, __cpu) SHIFT_PERCPU_PTR((__p), per_cpu_offset(__cpu)) #define CPU_ALLOC(type, flags) cpu_alloc(sizeof(type), flags, \ __alignof__(type))