--- mm/allocpercpu.c | 58 ++++++------------------------------------------------- 1 file changed, 7 insertions(+), 51 deletions(-) Index: linux-2.6/mm/allocpercpu.c =================================================================== --- linux-2.6.orig/mm/allocpercpu.c 2007-10-31 08:47:37.000000000 -0700 +++ linux-2.6/mm/allocpercpu.c 2007-10-31 09:11:19.000000000 -0700 @@ -90,65 +90,21 @@ static inline void cpu_free(void *pcpu) spin_unlock(&cpu_area_lock); } -/** - * percpu_populate - populate per-cpu data for given cpu - * @__pdata: per-cpu data to populate further - * @size: size of per-cpu object - * @gfp: may sleep or not etc. - * @cpu: populate per-data for this cpu - * - * Populating per-cpu data for a cpu coming online would be a typical - * use case. You need to register a cpu hotplug handler for that purpose. - * Per-cpu object is populated with zeroed buffer. - */ -static void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu) -{ - int pdata = (unsigned long)__percpu_disguise(__pdata); - void *p = (void *)per_cpu_offset(cpu) + pdata; - - memset(p, 0, size); - return p; -} - -/** - * percpu_populate_mask - populate per-cpu data for more cpu's - * @__pdata: per-cpu data to populate further - * @size: size of per-cpu object - * @gfp: may sleep or not etc. - * @mask: populate per-cpu data for cpu's selected through mask bits - * - * Per-cpu objects are populated with zeroed buffers. - */ -static int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, - cpumask_t *mask) -{ - int cpu; - - for_each_cpu_mask(cpu, *mask) - percpu_populate(__pdata, size, gfp, cpu); - return 0; -} - -/** - * percpu_alloc_mask - initial setup of per-cpu data - * @size: size of per-cpu object - * @gfp: may sleep or not etc. - * @mask: populate per-data for cpu's selected through mask bits - * - * Populating per-cpu data for all online cpu's would be a typical use case, - * which is simplified by the percpu_alloc() wrapper. - * Per-cpu objects are populated with zeroed buffers. - */ -void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) +void *__alloc_percpu(size_t size) { void *pdata = cpu_alloc(size); void *__pdata = __percpu_disguise(pdata); + int cpu; if (unlikely(!pdata)) return NULL; - __percpu_populate_mask(__pdata, size, gfp, mask); + + for_each_possible_cpu(cpu) + memset(per_cpu_ptr(__pdata, cpu) , 0, size); + return __pdata; } +EXPORT_SYMBOL(__alloc_percpu); /** * percpu_free - final cleanup of per-cpu data