aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-08-14 02:00:51 -0400
committerTejun Heo <tj@kernel.org>2009-08-14 02:00:51 -0400
commitfb435d5233f8b6f9b93c11d6304d8e98fed03234 (patch)
tree76a210c3895b9db5dc7e1f185ee0a60744fef99a /include
parentfd1e8a1fe2b54df6c185b4fa65f181f50b9c4d4e (diff)
percpu: add pcpu_unit_offsets[]
Currently units are mapped sequentially into address space. This patch adds pcpu_unit_offsets[] which allows units to be mapped to arbitrary offsets from the chunk base address. This is necessary to allow sparse embedding which might would need to allocate address ranges and memory areas which aren't aligned to unit size but allocation atom size (page or large page size). This also simplifies things a bit by removing the need to calculate offset from unit number. With this change, there's no need for the arch code to know pcpu_unit_size. Update pcpu_setup_first_chunk() and first chunk allocators to return regular 0 or -errno return code instead of unit size or -errno. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/percpu.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 77b86be8ce4f..a7ec840f596c 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -57,7 +57,7 @@
57#endif 57#endif
58 58
59extern void *pcpu_base_addr; 59extern void *pcpu_base_addr;
60extern const int *pcpu_unit_map; 60extern const unsigned long *pcpu_unit_offsets;
61 61
62struct pcpu_group_info { 62struct pcpu_group_info {
63 int nr_units; /* aligned # of units */ 63 int nr_units; /* aligned # of units */
@@ -106,25 +106,23 @@ extern struct pcpu_alloc_info * __init pcpu_build_alloc_info(
106 size_t atom_size, 106 size_t atom_size,
107 pcpu_fc_cpu_distance_fn_t cpu_distance_fn); 107 pcpu_fc_cpu_distance_fn_t cpu_distance_fn);
108 108
109extern size_t __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, 109extern int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
110 void *base_addr); 110 void *base_addr);
111 111
112#ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK 112#ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK
113extern ssize_t __init pcpu_embed_first_chunk( 113extern int __init pcpu_embed_first_chunk(size_t reserved_size,
114 size_t reserved_size, ssize_t dyn_size); 114 ssize_t dyn_size);
115#endif 115#endif
116 116
117#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK 117#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK
118extern ssize_t __init pcpu_page_first_chunk( 118extern int __init pcpu_page_first_chunk(size_t reserved_size,
119 size_t reserved_size,
120 pcpu_fc_alloc_fn_t alloc_fn, 119 pcpu_fc_alloc_fn_t alloc_fn,
121 pcpu_fc_free_fn_t free_fn, 120 pcpu_fc_free_fn_t free_fn,
122 pcpu_fc_populate_pte_fn_t populate_pte_fn); 121 pcpu_fc_populate_pte_fn_t populate_pte_fn);
123#endif 122#endif
124 123
125#ifdef CONFIG_NEED_PER_CPU_LPAGE_FIRST_CHUNK 124#ifdef CONFIG_NEED_PER_CPU_LPAGE_FIRST_CHUNK
126extern ssize_t __init pcpu_lpage_first_chunk( 125extern int __init pcpu_lpage_first_chunk(const struct pcpu_alloc_info *ai,
127 const struct pcpu_alloc_info *ai,
128 pcpu_fc_alloc_fn_t alloc_fn, 126 pcpu_fc_alloc_fn_t alloc_fn,
129 pcpu_fc_free_fn_t free_fn, 127 pcpu_fc_free_fn_t free_fn,
130 pcpu_fc_map_fn_t map_fn); 128 pcpu_fc_map_fn_t map_fn);