diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-22 20:31:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-22 20:31:36 -0400 |
commit | 0fc0531e0a2174377a86fd6953ecaa00287d8f70 (patch) | |
tree | afe56978729300df96b002a064c9de927fadcfab /include/linux/percpu.h | |
parent | 91b745016c12d440386c40fb76ab69c8e08cbc06 (diff) | |
parent | 9329ba9704f6bd51a735982e0d4a3eed72c3294f (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu:
percpu: update comments to reflect that percpu allocations are always zero-filled
percpu: Optimize __get_cpu_var()
x86, percpu: Optimize this_cpu_ptr
percpu: clear memory allocated with the km allocator
percpu: fix build breakage on s390 and cleanup build configuration tests
percpu: use percpu allocator on UP too
percpu: reduce PCPU_MIN_UNIT_SIZE to 32k
vmalloc: pcpu_get/free_vm_areas() aren't needed on UP
Fixed up trivial conflicts in include/linux/percpu.h
Diffstat (limited to 'include/linux/percpu.h')
-rw-r--r-- | include/linux/percpu.h | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 0eb50832aa00..5095b834a6fb 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -48,10 +48,8 @@ | |||
48 | preempt_enable(); \ | 48 | preempt_enable(); \ |
49 | } while (0) | 49 | } while (0) |
50 | 50 | ||
51 | #ifdef CONFIG_SMP | ||
52 | |||
53 | /* minimum unit size, also is the maximum supported allocation size */ | 51 | /* minimum unit size, also is the maximum supported allocation size */ |
54 | #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) | 52 | #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(32 << 10) |
55 | 53 | ||
56 | /* | 54 | /* |
57 | * Percpu allocator can serve percpu allocations before slab is | 55 | * Percpu allocator can serve percpu allocations before slab is |
@@ -146,37 +144,20 @@ extern int __init pcpu_page_first_chunk(size_t reserved_size, | |||
146 | * dynamically allocated. Non-atomic access to the current CPU's | 144 | * dynamically allocated. Non-atomic access to the current CPU's |
147 | * version should probably be combined with get_cpu()/put_cpu(). | 145 | * version should probably be combined with get_cpu()/put_cpu(). |
148 | */ | 146 | */ |
147 | #ifdef CONFIG_SMP | ||
149 | #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) | 148 | #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) |
149 | #else | ||
150 | #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR((ptr)); }) | ||
151 | #endif | ||
150 | 152 | ||
151 | extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align); | 153 | extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align); |
152 | extern bool is_kernel_percpu_address(unsigned long addr); | 154 | extern bool is_kernel_percpu_address(unsigned long addr); |
153 | 155 | ||
154 | #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA | 156 | #if !defined(CONFIG_SMP) || !defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) |
155 | extern void __init setup_per_cpu_areas(void); | 157 | extern void __init setup_per_cpu_areas(void); |
156 | #endif | 158 | #endif |
157 | extern void __init percpu_init_late(void); | 159 | extern void __init percpu_init_late(void); |
158 | 160 | ||
159 | #else /* CONFIG_SMP */ | ||
160 | |||
161 | #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR((ptr)); }) | ||
162 | |||
163 | /* can't distinguish from other static vars, always false */ | ||
164 | static inline bool is_kernel_percpu_address(unsigned long addr) | ||
165 | { | ||
166 | return false; | ||
167 | } | ||
168 | |||
169 | static inline void __init setup_per_cpu_areas(void) { } | ||
170 | |||
171 | static inline void __init percpu_init_late(void) { } | ||
172 | |||
173 | static inline void *pcpu_lpage_remapped(void *kaddr) | ||
174 | { | ||
175 | return NULL; | ||
176 | } | ||
177 | |||
178 | #endif /* CONFIG_SMP */ | ||
179 | |||
180 | extern void __percpu *__alloc_percpu(size_t size, size_t align); | 161 | extern void __percpu *__alloc_percpu(size_t size, size_t align); |
181 | extern void free_percpu(void __percpu *__pdata); | 162 | extern void free_percpu(void __percpu *__pdata); |
182 | extern phys_addr_t per_cpu_ptr_to_phys(void *addr); | 163 | extern phys_addr_t per_cpu_ptr_to_phys(void *addr); |