aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-03-06 00:33:59 -0500
committerTejun Heo <tj@kernel.org>2009-03-06 00:33:59 -0500
commitedcb463997ed7b2ffa3bac76e3e75957318f2e01 (patch)
treed1eefb78736404993b0de4a049392f9af578e29e /arch
parent3e24aa58907c62bc79d1094e941a374568f62522 (diff)
percpu, module: implement reserved allocation and use it for module percpu variables
Impact: add reserved allocation functionality and use it for module percpu variables This patch implements reserved allocation from the first chunk. When setting up the first chunk, arch can ask to set aside certain number of bytes right after the core static area which is available only through a separate reserved allocator. This will be used primarily for module static percpu variables on architectures with limited relocation range to ensure that the module perpcu symbols are inside the relocatable range. If reserved area is requested, the first chunk becomes reserved and isn't available for regular allocation. If the first chunk also includes piggy-back dynamic allocation area, a separate chunk mapping the same region is created to serve dynamic allocation. The first one is called static first chunk and the second dynamic first chunk. Although they share the page map, their different area map initializations guarantee they serve disjoint areas according to their purposes. If arch doesn't setup reserved area, reserved allocation is handled like any other allocation. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/setup_percpu.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 38e2b2a470a..dd4eabc747c 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -217,7 +217,7 @@ proceed:
217 pr_info("PERCPU: Remapped at %p with large pages, static data " 217 pr_info("PERCPU: Remapped at %p with large pages, static data "
218 "%zu bytes\n", vm.addr, static_size); 218 "%zu bytes\n", vm.addr, static_size);
219 219
220 ret = pcpu_setup_first_chunk(pcpur_get_page, static_size, PMD_SIZE, 220 ret = pcpu_setup_first_chunk(pcpur_get_page, static_size, 0, PMD_SIZE,
221 pcpur_size - static_size, vm.addr, NULL); 221 pcpur_size - static_size, vm.addr, NULL);
222 goto out_free_ar; 222 goto out_free_ar;
223 223
@@ -297,7 +297,7 @@ static ssize_t __init setup_pcpu_embed(size_t static_size)
297 pr_info("PERCPU: Embedded %zu pages at %p, static data %zu bytes\n", 297 pr_info("PERCPU: Embedded %zu pages at %p, static data %zu bytes\n",
298 pcpue_size >> PAGE_SHIFT, pcpue_ptr, static_size); 298 pcpue_size >> PAGE_SHIFT, pcpue_ptr, static_size);
299 299
300 return pcpu_setup_first_chunk(pcpue_get_page, static_size, 300 return pcpu_setup_first_chunk(pcpue_get_page, static_size, 0,
301 pcpue_unit_size, dyn_size, 301 pcpue_unit_size, dyn_size,
302 pcpue_ptr, NULL); 302 pcpue_ptr, NULL);
303} 303}
@@ -356,8 +356,8 @@ static ssize_t __init setup_pcpu_4k(size_t static_size)
356 pr_info("PERCPU: Allocated %d 4k pages, static data %zu bytes\n", 356 pr_info("PERCPU: Allocated %d 4k pages, static data %zu bytes\n",
357 pcpu4k_nr_static_pages, static_size); 357 pcpu4k_nr_static_pages, static_size);
358 358
359 ret = pcpu_setup_first_chunk(pcpu4k_get_page, static_size, -1, -1, NULL, 359 ret = pcpu_setup_first_chunk(pcpu4k_get_page, static_size, 0, -1, -1,
360 pcpu4k_populate_pte); 360 NULL, pcpu4k_populate_pte);
361 goto out_free_ar; 361 goto out_free_ar;
362 362
363enomem: 363enomem: