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 | 9a7737691e90d3cce0e5248f91826c50e5aa3fcf (patch) | |
tree | dbe43cb2d2a19539ca3fb58c52e4cbd68b51d24b /arch/x86 | |
parent | f58dc01ba2ca9fe3ab2ba4ca43d9c8a735cf62d8 (diff) |
percpu: drop @static_size from first chunk allocators
First chunk allocators assume percpu areas have been linked using one
of PERCPU_*() macros and depend on __per_cpu_load symbol defined by
those macros, so there isn't much point in passing in static area size
explicitly when it can be easily calculated from __per_cpu_start and
__per_cpu_end. Drop @static_size from all percpu first chunk
allocators and helpers.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/setup_percpu.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c index b961d99e6416..8aad486c688f 100644 --- a/arch/x86/kernel/setup_percpu.c +++ b/arch/x86/kernel/setup_percpu.c | |||
@@ -157,7 +157,7 @@ static int pcpu_lpage_cpu_distance(unsigned int from, unsigned int to) | |||
157 | return REMOTE_DISTANCE; | 157 | return REMOTE_DISTANCE; |
158 | } | 158 | } |
159 | 159 | ||
160 | static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) | 160 | static ssize_t __init setup_pcpu_lpage(bool chosen) |
161 | { | 161 | { |
162 | size_t reserve = PERCPU_MODULE_RESERVE + PERCPU_DYNAMIC_RESERVE; | 162 | size_t reserve = PERCPU_MODULE_RESERVE + PERCPU_DYNAMIC_RESERVE; |
163 | size_t dyn_size = reserve - PERCPU_FIRST_CHUNK_RESERVE; | 163 | size_t dyn_size = reserve - PERCPU_FIRST_CHUNK_RESERVE; |
@@ -184,8 +184,7 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) | |||
184 | return -ENOMEM; | 184 | return -ENOMEM; |
185 | } | 185 | } |
186 | 186 | ||
187 | ret = pcpu_lpage_build_unit_map(static_size, | 187 | ret = pcpu_lpage_build_unit_map(PERCPU_FIRST_CHUNK_RESERVE, |
188 | PERCPU_FIRST_CHUNK_RESERVE, | ||
189 | &dyn_size, &unit_size, PMD_SIZE, | 188 | &dyn_size, &unit_size, PMD_SIZE, |
190 | unit_map, pcpu_lpage_cpu_distance); | 189 | unit_map, pcpu_lpage_cpu_distance); |
191 | if (ret < 0) { | 190 | if (ret < 0) { |
@@ -208,9 +207,8 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) | |||
208 | } | 207 | } |
209 | } | 208 | } |
210 | 209 | ||
211 | ret = pcpu_lpage_first_chunk(static_size, PERCPU_FIRST_CHUNK_RESERVE, | 210 | ret = pcpu_lpage_first_chunk(PERCPU_FIRST_CHUNK_RESERVE, dyn_size, |
212 | dyn_size, unit_size, PMD_SIZE, | 211 | unit_size, PMD_SIZE, unit_map, nr_units, |
213 | unit_map, nr_units, | ||
214 | pcpu_fc_alloc, pcpu_fc_free, pcpul_map); | 212 | pcpu_fc_alloc, pcpu_fc_free, pcpul_map); |
215 | out_free: | 213 | out_free: |
216 | if (ret < 0) | 214 | if (ret < 0) |
@@ -218,7 +216,7 @@ out_free: | |||
218 | return ret; | 216 | return ret; |
219 | } | 217 | } |
220 | #else | 218 | #else |
221 | static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) | 219 | static ssize_t __init setup_pcpu_lpage(bool chosen) |
222 | { | 220 | { |
223 | return -EINVAL; | 221 | return -EINVAL; |
224 | } | 222 | } |
@@ -232,7 +230,7 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) | |||
232 | * mapping so that it can use PMD mapping without additional TLB | 230 | * mapping so that it can use PMD mapping without additional TLB |
233 | * pressure. | 231 | * pressure. |
234 | */ | 232 | */ |
235 | static ssize_t __init setup_pcpu_embed(size_t static_size, bool chosen) | 233 | static ssize_t __init setup_pcpu_embed(bool chosen) |
236 | { | 234 | { |
237 | size_t reserve = PERCPU_MODULE_RESERVE + PERCPU_DYNAMIC_RESERVE; | 235 | size_t reserve = PERCPU_MODULE_RESERVE + PERCPU_DYNAMIC_RESERVE; |
238 | 236 | ||
@@ -244,7 +242,7 @@ static ssize_t __init setup_pcpu_embed(size_t static_size, bool chosen) | |||
244 | if (!chosen && (!cpu_has_pse || pcpu_need_numa())) | 242 | if (!chosen && (!cpu_has_pse || pcpu_need_numa())) |
245 | return -EINVAL; | 243 | return -EINVAL; |
246 | 244 | ||
247 | return pcpu_embed_first_chunk(static_size, PERCPU_FIRST_CHUNK_RESERVE, | 245 | return pcpu_embed_first_chunk(PERCPU_FIRST_CHUNK_RESERVE, |
248 | reserve - PERCPU_FIRST_CHUNK_RESERVE); | 246 | reserve - PERCPU_FIRST_CHUNK_RESERVE); |
249 | } | 247 | } |
250 | 248 | ||
@@ -260,9 +258,9 @@ static void __init pcpup_populate_pte(unsigned long addr) | |||
260 | populate_extra_pte(addr); | 258 | populate_extra_pte(addr); |
261 | } | 259 | } |
262 | 260 | ||
263 | static ssize_t __init setup_pcpu_page(size_t static_size) | 261 | static ssize_t __init setup_pcpu_page(void) |
264 | { | 262 | { |
265 | return pcpu_page_first_chunk(static_size, PERCPU_FIRST_CHUNK_RESERVE, | 263 | return pcpu_page_first_chunk(PERCPU_FIRST_CHUNK_RESERVE, |
266 | pcpu_fc_alloc, pcpu_fc_free, | 264 | pcpu_fc_alloc, pcpu_fc_free, |
267 | pcpup_populate_pte); | 265 | pcpup_populate_pte); |
268 | } | 266 | } |
@@ -282,7 +280,6 @@ static inline void setup_percpu_segment(int cpu) | |||
282 | 280 | ||
283 | void __init setup_per_cpu_areas(void) | 281 | void __init setup_per_cpu_areas(void) |
284 | { | 282 | { |
285 | size_t static_size = __per_cpu_end - __per_cpu_start; | ||
286 | unsigned int cpu; | 283 | unsigned int cpu; |
287 | unsigned long delta; | 284 | unsigned long delta; |
288 | size_t pcpu_unit_size; | 285 | size_t pcpu_unit_size; |
@@ -300,9 +297,9 @@ void __init setup_per_cpu_areas(void) | |||
300 | if (pcpu_chosen_fc != PCPU_FC_AUTO) { | 297 | if (pcpu_chosen_fc != PCPU_FC_AUTO) { |
301 | if (pcpu_chosen_fc != PCPU_FC_PAGE) { | 298 | if (pcpu_chosen_fc != PCPU_FC_PAGE) { |
302 | if (pcpu_chosen_fc == PCPU_FC_LPAGE) | 299 | if (pcpu_chosen_fc == PCPU_FC_LPAGE) |
303 | ret = setup_pcpu_lpage(static_size, true); | 300 | ret = setup_pcpu_lpage(true); |
304 | else | 301 | else |
305 | ret = setup_pcpu_embed(static_size, true); | 302 | ret = setup_pcpu_embed(true); |
306 | 303 | ||
307 | if (ret < 0) | 304 | if (ret < 0) |
308 | pr_warning("PERCPU: %s allocator failed (%zd), " | 305 | pr_warning("PERCPU: %s allocator failed (%zd), " |
@@ -310,15 +307,14 @@ void __init setup_per_cpu_areas(void) | |||
310 | pcpu_fc_names[pcpu_chosen_fc], ret); | 307 | pcpu_fc_names[pcpu_chosen_fc], ret); |
311 | } | 308 | } |
312 | } else { | 309 | } else { |
313 | ret = setup_pcpu_lpage(static_size, false); | 310 | ret = setup_pcpu_lpage(false); |
314 | if (ret < 0) | 311 | if (ret < 0) |
315 | ret = setup_pcpu_embed(static_size, false); | 312 | ret = setup_pcpu_embed(false); |
316 | } | 313 | } |
317 | if (ret < 0) | 314 | if (ret < 0) |
318 | ret = setup_pcpu_page(static_size); | 315 | ret = setup_pcpu_page(); |
319 | if (ret < 0) | 316 | if (ret < 0) |
320 | panic("cannot allocate static percpu area (%zu bytes, err=%zd)", | 317 | panic("cannot initialize percpu area (err=%zd)", ret); |
321 | static_size, ret); | ||
322 | 318 | ||
323 | pcpu_unit_size = ret; | 319 | pcpu_unit_size = ret; |
324 | 320 | ||