aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-06-27 12:50:00 -0400
committerTejun Heo <tj@kernel.org>2010-06-27 12:50:00 -0400
commit099a19d91ca429944743d51bef8fee240e94d8e3 (patch)
tree55bdc0f25ecbf38240782fb1d9a80d33c0100eb6 /include
parent4ba6ce250e406b20bcd6f0f3aed6b3d80965e6c2 (diff)
percpu: allow limited allocation before slab is online
This patch updates percpu allocator such that it can serve limited amount of allocation before slab comes online. This is primarily to allow slab to depend on working percpu allocator. Two parameters, PERCPU_DYNAMIC_EARLY_SIZE and SLOTS, determine how much memory space and allocation map slots are reserved. If this reserved area is exhausted, WARN_ON_ONCE() will trigger and allocation will fail till slab comes online. The following changes are made to implement early alloc. * pcpu_mem_alloc() now checks slab_is_available() * Chunks are allocated using pcpu_mem_alloc() * Init paths make sure ai->dyn_size is at least as large as PERCPU_DYNAMIC_EARLY_SIZE. * Initial alloc maps are allocated in __initdata and copied to kmalloc'd areas once slab is online. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Christoph Lameter <cl@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/percpu.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 3ffd05e550de..b8b9084527b1 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -45,6 +45,16 @@
45#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) 45#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10)
46 46
47/* 47/*
48 * Percpu allocator can serve percpu allocations before slab is
49 * initialized which allows slab to depend on the percpu allocator.
50 * The following two parameters decide how much resource to
51 * preallocate for this. Keep PERCPU_DYNAMIC_RESERVE equal to or
52 * larger than PERCPU_DYNAMIC_EARLY_SIZE.
53 */
54#define PERCPU_DYNAMIC_EARLY_SLOTS 128
55#define PERCPU_DYNAMIC_EARLY_SIZE (12 << 10)
56
57/*
48 * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy 58 * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy
49 * back on the first chunk for dynamic percpu allocation if arch is 59 * back on the first chunk for dynamic percpu allocation if arch is
50 * manually allocating and mapping it for faster access (as a part of 60 * manually allocating and mapping it for faster access (as a part of
@@ -135,6 +145,7 @@ extern bool is_kernel_percpu_address(unsigned long addr);
135#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA 145#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
136extern void __init setup_per_cpu_areas(void); 146extern void __init setup_per_cpu_areas(void);
137#endif 147#endif
148extern void __init percpu_init_late(void);
138 149
139#else /* CONFIG_SMP */ 150#else /* CONFIG_SMP */
140 151
@@ -148,6 +159,8 @@ static inline bool is_kernel_percpu_address(unsigned long addr)
148 159
149static inline void __init setup_per_cpu_areas(void) { } 160static inline void __init setup_per_cpu_areas(void) { }
150 161
162static inline void __init percpu_init_late(void) { }
163
151static inline void *pcpu_lpage_remapped(void *kaddr) 164static inline void *pcpu_lpage_remapped(void *kaddr)
152{ 165{
153 return NULL; 166 return NULL;