aboutsummaryrefslogtreecommitdiffstats
path: root/mm/percpu.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-08-14 02:00:50 -0400
committerTejun Heo <tj@kernel.org>2009-08-14 02:00:50 -0400
commitf58dc01ba2ca9fe3ab2ba4ca43d9c8a735cf62d8 (patch)
tree9eb76a0d6aa34e56f8650fe98a5ce26891a522ab /mm/percpu.c
parent08fc45806103e59a37418e84719b878f9bb32540 (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 'mm/percpu.c')
-rw-r--r--mm/percpu.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/mm/percpu.c b/mm/percpu.c
index 7971997de310..7fb40bb1555a 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1414,6 +1414,38 @@ size_t __init pcpu_setup_first_chunk(size_t static_size, size_t reserved_size,
1414 return pcpu_unit_size; 1414 return pcpu_unit_size;
1415} 1415}
1416 1416
1417const char *pcpu_fc_names[PCPU_FC_NR] __initdata = {
1418 [PCPU_FC_AUTO] = "auto",
1419 [PCPU_FC_EMBED] = "embed",
1420 [PCPU_FC_PAGE] = "page",
1421 [PCPU_FC_LPAGE] = "lpage",
1422};
1423
1424enum pcpu_fc pcpu_chosen_fc __initdata = PCPU_FC_AUTO;
1425
1426static int __init percpu_alloc_setup(char *str)
1427{
1428 if (0)
1429 /* nada */;
1430#ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK
1431 else if (!strcmp(str, "embed"))
1432 pcpu_chosen_fc = PCPU_FC_EMBED;
1433#endif
1434#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK
1435 else if (!strcmp(str, "page"))
1436 pcpu_chosen_fc = PCPU_FC_PAGE;
1437#endif
1438#ifdef CONFIG_NEED_PER_CPU_LPAGE_FIRST_CHUNK
1439 else if (!strcmp(str, "lpage"))
1440 pcpu_chosen_fc = PCPU_FC_LPAGE;
1441#endif
1442 else
1443 pr_warning("PERCPU: unknown allocator %s specified\n", str);
1444
1445 return 0;
1446}
1447early_param("percpu_alloc", percpu_alloc_setup);
1448
1417static inline size_t pcpu_calc_fc_sizes(size_t static_size, 1449static inline size_t pcpu_calc_fc_sizes(size_t static_size,
1418 size_t reserved_size, 1450 size_t reserved_size,
1419 ssize_t *dyn_sizep) 1451 ssize_t *dyn_sizep)