diff options
author | Tejun Heo <tj@kernel.org> | 2009-08-14 02:00:50 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-08-14 02:00:50 -0400 |
commit | f58dc01ba2ca9fe3ab2ba4ca43d9c8a735cf62d8 (patch) | |
tree | 9eb76a0d6aa34e56f8650fe98a5ce26891a522ab /arch/x86 | |
parent | 08fc45806103e59a37418e84719b878f9bb32540 (diff) |
percpu: generalize first chunk allocator selection
Now that all first chunk allocators are in mm/percpu.c, it makes sense
to make generalize percpu_alloc kernel parameter. Define PCPU_FC_*
and set pcpu_chosen_fc using early_param() in mm/percpu.c. Arch code
can use the set value to determine which first chunk allocator to use.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/setup_percpu.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c index 1e17711c29d6..b961d99e6416 100644 --- a/arch/x86/kernel/setup_percpu.c +++ b/arch/x86/kernel/setup_percpu.c | |||
@@ -267,16 +267,6 @@ static ssize_t __init setup_pcpu_page(size_t static_size) | |||
267 | pcpup_populate_pte); | 267 | pcpup_populate_pte); |
268 | } | 268 | } |
269 | 269 | ||
270 | /* for explicit first chunk allocator selection */ | ||
271 | static char pcpu_chosen_alloc[16] __initdata; | ||
272 | |||
273 | static int __init percpu_alloc_setup(char *str) | ||
274 | { | ||
275 | strncpy(pcpu_chosen_alloc, str, sizeof(pcpu_chosen_alloc) - 1); | ||
276 | return 0; | ||
277 | } | ||
278 | early_param("percpu_alloc", percpu_alloc_setup); | ||
279 | |||
280 | static inline void setup_percpu_segment(int cpu) | 270 | static inline void setup_percpu_segment(int cpu) |
281 | { | 271 | { |
282 | #ifdef CONFIG_X86_32 | 272 | #ifdef CONFIG_X86_32 |
@@ -307,19 +297,17 @@ void __init setup_per_cpu_areas(void) | |||
307 | * each allocator for details. | 297 | * each allocator for details. |
308 | */ | 298 | */ |
309 | ret = -EINVAL; | 299 | ret = -EINVAL; |
310 | if (strlen(pcpu_chosen_alloc)) { | 300 | if (pcpu_chosen_fc != PCPU_FC_AUTO) { |
311 | if (strcmp(pcpu_chosen_alloc, "page")) { | 301 | if (pcpu_chosen_fc != PCPU_FC_PAGE) { |
312 | if (!strcmp(pcpu_chosen_alloc, "lpage")) | 302 | if (pcpu_chosen_fc == PCPU_FC_LPAGE) |
313 | ret = setup_pcpu_lpage(static_size, true); | 303 | ret = setup_pcpu_lpage(static_size, true); |
314 | else if (!strcmp(pcpu_chosen_alloc, "embed")) | ||
315 | ret = setup_pcpu_embed(static_size, true); | ||
316 | else | 304 | else |
317 | pr_warning("PERCPU: unknown allocator %s " | 305 | ret = setup_pcpu_embed(static_size, true); |
318 | "specified\n", pcpu_chosen_alloc); | 306 | |
319 | if (ret < 0) | 307 | if (ret < 0) |
320 | pr_warning("PERCPU: %s allocator failed (%zd), " | 308 | pr_warning("PERCPU: %s allocator failed (%zd), " |
321 | "falling back to page size\n", | 309 | "falling back to page size\n", |
322 | pcpu_chosen_alloc, ret); | 310 | pcpu_fc_names[pcpu_chosen_fc], ret); |
323 | } | 311 | } |
324 | } else { | 312 | } else { |
325 | ret = setup_pcpu_lpage(static_size, false); | 313 | ret = setup_pcpu_lpage(static_size, false); |