aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-07-03 19:10:59 -0400
committerTejun Heo <tj@kernel.org>2009-07-03 19:10:59 -0400
commit8c4bfc6e8801616ab2e01c38140b2159b388d2ff (patch)
treee29e8bbfae362362554b870371a6187b41f92d82 /include
parent8f05a6a65d944f2fed4eb384fb58aa8c8e5a9bab (diff)
x86,percpu: generalize lpage first chunk allocator
Generalize and move x86 setup_pcpu_lpage() into pcpu_lpage_first_chunk(). setup_pcpu_lpage() now is a simple wrapper around the generalized version. Other than taking size parameters and using arch supplied callbacks to allocate/free/map memory, pcpu_lpage_first_chunk() is identical to the original implementation. This simplifies arch code and will help converting more archs to dynamic percpu allocator. While at it, factor out pcpu_calc_fc_sizes() which is common to pcpu_embed_first_chunk() and pcpu_lpage_first_chunk(). [ Impact: code reorganization and generalization ] Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r--include/linux/percpu.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 41b5bfab4195..9f6bfd7d4b92 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -62,6 +62,7 @@ typedef struct page * (*pcpu_get_page_fn_t)(unsigned int cpu, int pageno);
62typedef void * (*pcpu_fc_alloc_fn_t)(unsigned int cpu, size_t size); 62typedef void * (*pcpu_fc_alloc_fn_t)(unsigned int cpu, size_t size);
63typedef void (*pcpu_fc_free_fn_t)(void *ptr, size_t size); 63typedef void (*pcpu_fc_free_fn_t)(void *ptr, size_t size);
64typedef void (*pcpu_fc_populate_pte_fn_t)(unsigned long addr); 64typedef void (*pcpu_fc_populate_pte_fn_t)(unsigned long addr);
65typedef void (*pcpu_fc_map_fn_t)(void *ptr, size_t size, void *addr);
65 66
66extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, 67extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn,
67 size_t static_size, size_t reserved_size, 68 size_t static_size, size_t reserved_size,
@@ -79,6 +80,32 @@ extern ssize_t __init pcpu_4k_first_chunk(
79 pcpu_fc_free_fn_t free_fn, 80 pcpu_fc_free_fn_t free_fn,
80 pcpu_fc_populate_pte_fn_t populate_pte_fn); 81 pcpu_fc_populate_pte_fn_t populate_pte_fn);
81 82
83#ifdef CONFIG_NEED_MULTIPLE_NODES
84extern ssize_t __init pcpu_lpage_first_chunk(
85 size_t static_size, size_t reserved_size,
86 ssize_t dyn_size, size_t lpage_size,
87 pcpu_fc_alloc_fn_t alloc_fn,
88 pcpu_fc_free_fn_t free_fn,
89 pcpu_fc_map_fn_t map_fn);
90
91extern void *pcpu_lpage_remapped(void *kaddr);
92#else
93static inline ssize_t __init pcpu_lpage_first_chunk(
94 size_t static_size, size_t reserved_size,
95 ssize_t dyn_size, size_t lpage_size,
96 pcpu_fc_alloc_fn_t alloc_fn,
97 pcpu_fc_free_fn_t free_fn,
98 pcpu_fc_map_fn_t map_fn)
99{
100 return -EINVAL;
101}
102
103static inline void *pcpu_lpage_remapped(void *kaddr)
104{
105 return NULL;
106}
107#endif
108
82/* 109/*
83 * Use this to get to a cpu's version of the per-cpu object 110 * Use this to get to a cpu's version of the per-cpu object
84 * dynamically allocated. Non-atomic access to the current CPU's 111 * dynamically allocated. Non-atomic access to the current CPU's