diff options
-rw-r--r-- | include/linux/percpu.h | 29 | ||||
-rw-r--r-- | mm/allocpercpu.c | 20 |
2 files changed, 11 insertions, 38 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 4cdd393e71e1..fac3337547eb 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -74,11 +74,6 @@ struct percpu_data { | |||
74 | (__typeof__(ptr))__p->ptrs[(cpu)]; \ | 74 | (__typeof__(ptr))__p->ptrs[(cpu)]; \ |
75 | }) | 75 | }) |
76 | 76 | ||
77 | extern void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu); | ||
78 | extern void percpu_depopulate(void *__pdata, int cpu); | ||
79 | extern int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, | ||
80 | cpumask_t *mask); | ||
81 | extern void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask); | ||
82 | extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask); | 77 | extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask); |
83 | extern void percpu_free(void *__pdata); | 78 | extern void percpu_free(void *__pdata); |
84 | 79 | ||
@@ -86,26 +81,6 @@ extern void percpu_free(void *__pdata); | |||
86 | 81 | ||
87 | #define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) | 82 | #define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) |
88 | 83 | ||
89 | static inline void percpu_depopulate(void *__pdata, int cpu) | ||
90 | { | ||
91 | } | ||
92 | |||
93 | static inline void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask) | ||
94 | { | ||
95 | } | ||
96 | |||
97 | static inline void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, | ||
98 | int cpu) | ||
99 | { | ||
100 | return percpu_ptr(__pdata, cpu); | ||
101 | } | ||
102 | |||
103 | static inline int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, | ||
104 | cpumask_t *mask) | ||
105 | { | ||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) | 84 | static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) |
110 | { | 85 | { |
111 | return kzalloc(size, gfp); | 86 | return kzalloc(size, gfp); |
@@ -118,10 +93,6 @@ static inline void percpu_free(void *__pdata) | |||
118 | 93 | ||
119 | #endif /* CONFIG_SMP */ | 94 | #endif /* CONFIG_SMP */ |
120 | 95 | ||
121 | #define percpu_populate_mask(__pdata, size, gfp, mask) \ | ||
122 | __percpu_populate_mask((__pdata), (size), (gfp), &(mask)) | ||
123 | #define percpu_depopulate_mask(__pdata, mask) \ | ||
124 | __percpu_depopulate_mask((__pdata), &(mask)) | ||
125 | #define percpu_alloc_mask(size, gfp, mask) \ | 96 | #define percpu_alloc_mask(size, gfp, mask) \ |
126 | __percpu_alloc_mask((size), (gfp), &(mask)) | 97 | __percpu_alloc_mask((size), (gfp), &(mask)) |
127 | 98 | ||
diff --git a/mm/allocpercpu.c b/mm/allocpercpu.c index 843364594e23..4297bc41bfd2 100644 --- a/mm/allocpercpu.c +++ b/mm/allocpercpu.c | |||
@@ -18,27 +18,28 @@ | |||
18 | * Depopulating per-cpu data for a cpu going offline would be a typical | 18 | * Depopulating per-cpu data for a cpu going offline would be a typical |
19 | * use case. You need to register a cpu hotplug handler for that purpose. | 19 | * use case. You need to register a cpu hotplug handler for that purpose. |
20 | */ | 20 | */ |
21 | void percpu_depopulate(void *__pdata, int cpu) | 21 | static void percpu_depopulate(void *__pdata, int cpu) |
22 | { | 22 | { |
23 | struct percpu_data *pdata = __percpu_disguise(__pdata); | 23 | struct percpu_data *pdata = __percpu_disguise(__pdata); |
24 | 24 | ||
25 | kfree(pdata->ptrs[cpu]); | 25 | kfree(pdata->ptrs[cpu]); |
26 | pdata->ptrs[cpu] = NULL; | 26 | pdata->ptrs[cpu] = NULL; |
27 | } | 27 | } |
28 | EXPORT_SYMBOL_GPL(percpu_depopulate); | ||
29 | 28 | ||
30 | /** | 29 | /** |
31 | * percpu_depopulate_mask - depopulate per-cpu data for some cpu's | 30 | * percpu_depopulate_mask - depopulate per-cpu data for some cpu's |
32 | * @__pdata: per-cpu data to depopulate | 31 | * @__pdata: per-cpu data to depopulate |
33 | * @mask: depopulate per-cpu data for cpu's selected through mask bits | 32 | * @mask: depopulate per-cpu data for cpu's selected through mask bits |
34 | */ | 33 | */ |
35 | void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask) | 34 | static void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask) |
36 | { | 35 | { |
37 | int cpu; | 36 | int cpu; |
38 | for_each_cpu_mask_nr(cpu, *mask) | 37 | for_each_cpu_mask_nr(cpu, *mask) |
39 | percpu_depopulate(__pdata, cpu); | 38 | percpu_depopulate(__pdata, cpu); |
40 | } | 39 | } |
41 | EXPORT_SYMBOL_GPL(__percpu_depopulate_mask); | 40 | |
41 | #define percpu_depopulate_mask(__pdata, mask) \ | ||
42 | __percpu_depopulate_mask((__pdata), &(mask)) | ||
42 | 43 | ||
43 | /** | 44 | /** |
44 | * percpu_populate - populate per-cpu data for given cpu | 45 | * percpu_populate - populate per-cpu data for given cpu |
@@ -51,7 +52,7 @@ EXPORT_SYMBOL_GPL(__percpu_depopulate_mask); | |||
51 | * use case. You need to register a cpu hotplug handler for that purpose. | 52 | * use case. You need to register a cpu hotplug handler for that purpose. |
52 | * Per-cpu object is populated with zeroed buffer. | 53 | * Per-cpu object is populated with zeroed buffer. |
53 | */ | 54 | */ |
54 | void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu) | 55 | static void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu) |
55 | { | 56 | { |
56 | struct percpu_data *pdata = __percpu_disguise(__pdata); | 57 | struct percpu_data *pdata = __percpu_disguise(__pdata); |
57 | int node = cpu_to_node(cpu); | 58 | int node = cpu_to_node(cpu); |
@@ -68,7 +69,6 @@ void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu) | |||
68 | pdata->ptrs[cpu] = kzalloc(size, gfp); | 69 | pdata->ptrs[cpu] = kzalloc(size, gfp); |
69 | return pdata->ptrs[cpu]; | 70 | return pdata->ptrs[cpu]; |
70 | } | 71 | } |
71 | EXPORT_SYMBOL_GPL(percpu_populate); | ||
72 | 72 | ||
73 | /** | 73 | /** |
74 | * percpu_populate_mask - populate per-cpu data for more cpu's | 74 | * percpu_populate_mask - populate per-cpu data for more cpu's |
@@ -79,8 +79,8 @@ EXPORT_SYMBOL_GPL(percpu_populate); | |||
79 | * | 79 | * |
80 | * Per-cpu objects are populated with zeroed buffers. | 80 | * Per-cpu objects are populated with zeroed buffers. |
81 | */ | 81 | */ |
82 | int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, | 82 | static int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, |
83 | cpumask_t *mask) | 83 | cpumask_t *mask) |
84 | { | 84 | { |
85 | cpumask_t populated; | 85 | cpumask_t populated; |
86 | int cpu; | 86 | int cpu; |
@@ -94,7 +94,9 @@ int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, | |||
94 | cpu_set(cpu, populated); | 94 | cpu_set(cpu, populated); |
95 | return 0; | 95 | return 0; |
96 | } | 96 | } |
97 | EXPORT_SYMBOL_GPL(__percpu_populate_mask); | 97 | |
98 | #define percpu_populate_mask(__pdata, size, gfp, mask) \ | ||
99 | __percpu_populate_mask((__pdata), (size), (gfp), &(mask)) | ||
98 | 100 | ||
99 | /** | 101 | /** |
100 | * percpu_alloc_mask - initial setup of per-cpu data | 102 | * percpu_alloc_mask - initial setup of per-cpu data |