aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/percpu.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-04-05 12:39:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-04-05 12:39:11 -0400
commitb66696e3c0d8fc01efdbc701eba1276618332cb3 (patch)
tree3094ef42787b8e0c900bce1f2391ced081ed1ba4 /include/linux/percpu.h
parent9e74e7c81a24aee66024fc477786bd1de84e293b (diff)
parenta32f3926632e71c8aa23ce32fe2625f8d5f792c2 (diff)
Merge branch 'slabh' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc
* 'slabh' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc: eeepc-wmi: include slab.h staging/otus: include slab.h from usbdrv.h percpu: don't implicitly include slab.h from percpu.h kmemcheck: Fix build errors due to missing slab.h include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h iwlwifi: don't include iwl-dev.h from iwl-devtrace.h x86: don't include slab.h from arch/x86/include/asm/pgtable_32.h Fix up trivial conflicts in include/linux/percpu.h due to is_kernel_percpu_address() having been introduced since the slab.h cleanup with the percpu_up.c splitup.
Diffstat (limited to 'include/linux/percpu.h')
-rw-r--r--include/linux/percpu.h30
1 files changed, 5 insertions, 25 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 11d5f834b54a..d3a38d687104 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -2,10 +2,10 @@
2#define __LINUX_PERCPU_H 2#define __LINUX_PERCPU_H
3 3
4#include <linux/preempt.h> 4#include <linux/preempt.h>
5#include <linux/slab.h> /* For kmalloc() */
6#include <linux/smp.h> 5#include <linux/smp.h>
7#include <linux/cpumask.h> 6#include <linux/cpumask.h>
8#include <linux/pfn.h> 7#include <linux/pfn.h>
8#include <linux/init.h>
9 9
10#include <asm/percpu.h> 10#include <asm/percpu.h>
11 11
@@ -135,10 +135,7 @@ extern int __init pcpu_page_first_chunk(size_t reserved_size,
135#define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) 135#define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)))
136 136
137extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align); 137extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align);
138extern void __percpu *__alloc_percpu(size_t size, size_t align);
139extern void free_percpu(void __percpu *__pdata);
140extern bool is_kernel_percpu_address(unsigned long addr); 138extern bool is_kernel_percpu_address(unsigned long addr);
141extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
142 139
143#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA 140#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
144extern void __init setup_per_cpu_areas(void); 141extern void __init setup_per_cpu_areas(void);
@@ -148,33 +145,12 @@ extern void __init setup_per_cpu_areas(void);
148 145
149#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 146#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
150 147
151static inline void __percpu *__alloc_percpu(size_t size, size_t align)
152{
153 /*
154 * Can't easily make larger alignment work with kmalloc. WARN
155 * on it. Larger alignment should only be used for module
156 * percpu sections on SMP for which this path isn't used.
157 */
158 WARN_ON_ONCE(align > SMP_CACHE_BYTES);
159 return kzalloc(size, GFP_KERNEL);
160}
161
162static inline void free_percpu(void __percpu *p)
163{
164 kfree(p);
165}
166
167/* can't distinguish from other static vars, always false */ 148/* can't distinguish from other static vars, always false */
168static inline bool is_kernel_percpu_address(unsigned long addr) 149static inline bool is_kernel_percpu_address(unsigned long addr)
169{ 150{
170 return false; 151 return false;
171} 152}
172 153
173static inline phys_addr_t per_cpu_ptr_to_phys(void *addr)
174{
175 return __pa(addr);
176}
177
178static inline void __init setup_per_cpu_areas(void) { } 154static inline void __init setup_per_cpu_areas(void) { }
179 155
180static inline void *pcpu_lpage_remapped(void *kaddr) 156static inline void *pcpu_lpage_remapped(void *kaddr)
@@ -184,6 +160,10 @@ static inline void *pcpu_lpage_remapped(void *kaddr)
184 160
185#endif /* CONFIG_SMP */ 161#endif /* CONFIG_SMP */
186 162
163extern void __percpu *__alloc_percpu(size_t size, size_t align);
164extern void free_percpu(void __percpu *__pdata);
165extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
166
187#define alloc_percpu(type) \ 167#define alloc_percpu(type) \
188 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) 168 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type))
189 169