aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/percpu.h2
-rw-r--r--mm/allocpercpu.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 50faa0ea28e4..1ac969724bb2 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -54,7 +54,7 @@
54#ifdef CONFIG_SMP 54#ifdef CONFIG_SMP
55 55
56struct percpu_data { 56struct percpu_data {
57 void *ptrs[NR_CPUS]; 57 void *ptrs[1];
58}; 58};
59 59
60#define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) 60#define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata)
diff --git a/mm/allocpercpu.c b/mm/allocpercpu.c
index 00b02623f008..7e58322b7134 100644
--- a/mm/allocpercpu.c
+++ b/mm/allocpercpu.c
@@ -98,7 +98,7 @@ EXPORT_SYMBOL_GPL(__percpu_populate_mask);
98 */ 98 */
99void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) 99void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask)
100{ 100{
101 void *pdata = kzalloc(sizeof(struct percpu_data), gfp); 101 void *pdata = kzalloc(nr_cpu_ids * sizeof(void *), gfp);
102 void *__pdata = __percpu_disguise(pdata); 102 void *__pdata = __percpu_disguise(pdata);
103 103
104 if (unlikely(!pdata)) 104 if (unlikely(!pdata))