diff options
author | Tejun Heo <tj@kernel.org> | 2009-07-03 19:10:59 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-07-03 19:10:59 -0400 |
commit | d4b95f80399471e4bce5e992700ff7f06ef91f6a (patch) | |
tree | a7b97c549629ea1032c36a41048ea847a20b8d27 /include | |
parent | 788e5abc5441e9046dd91c995c6f1f75bbd144bf (diff) |
x86,percpu: generalize 4k first chunk allocator
Generalize and move x86 setup_pcpu_4k() into pcpu_4k_first_chunk().
setup_pcpu_4k() now is a simple wrapper around the generalized
version. Other than taking size parameters and using arch supplied
callbacks to allocate/free memory, pcpu_4k_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, s/pcpu_populate_pte_fn_t/pcpu_fc_populate_pte_fn_t/ for
consistency.
[ 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.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 83bff053bd1c..41b5bfab4195 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -59,18 +59,26 @@ | |||
59 | extern void *pcpu_base_addr; | 59 | extern void *pcpu_base_addr; |
60 | 60 | ||
61 | typedef struct page * (*pcpu_get_page_fn_t)(unsigned int cpu, int pageno); | 61 | typedef struct page * (*pcpu_get_page_fn_t)(unsigned int cpu, int pageno); |
62 | typedef void (*pcpu_populate_pte_fn_t)(unsigned long addr); | 62 | typedef void * (*pcpu_fc_alloc_fn_t)(unsigned int cpu, size_t size); |
63 | typedef void (*pcpu_fc_free_fn_t)(void *ptr, size_t size); | ||
64 | typedef void (*pcpu_fc_populate_pte_fn_t)(unsigned long addr); | ||
63 | 65 | ||
64 | extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, | 66 | extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, |
65 | size_t static_size, size_t reserved_size, | 67 | size_t static_size, size_t reserved_size, |
66 | ssize_t dyn_size, ssize_t unit_size, | 68 | ssize_t dyn_size, ssize_t unit_size, |
67 | void *base_addr, | 69 | void *base_addr, |
68 | pcpu_populate_pte_fn_t populate_pte_fn); | 70 | pcpu_fc_populate_pte_fn_t populate_pte_fn); |
69 | 71 | ||
70 | extern ssize_t __init pcpu_embed_first_chunk( | 72 | extern ssize_t __init pcpu_embed_first_chunk( |
71 | size_t static_size, size_t reserved_size, | 73 | size_t static_size, size_t reserved_size, |
72 | ssize_t dyn_size); | 74 | ssize_t dyn_size); |
73 | 75 | ||
76 | extern ssize_t __init pcpu_4k_first_chunk( | ||
77 | size_t static_size, size_t reserved_size, | ||
78 | pcpu_fc_alloc_fn_t alloc_fn, | ||
79 | pcpu_fc_free_fn_t free_fn, | ||
80 | pcpu_fc_populate_pte_fn_t populate_pte_fn); | ||
81 | |||
74 | /* | 82 | /* |
75 | * Use this to get to a cpu's version of the per-cpu object | 83 | * Use this to get to a cpu's version of the per-cpu object |
76 | * dynamically allocated. Non-atomic access to the current CPU's | 84 | * dynamically allocated. Non-atomic access to the current CPU's |