diff options
author | Tejun Heo <tj@kernel.org> | 2009-08-14 02:00:52 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-08-14 02:00:52 -0400 |
commit | ca23e405e06d5fffb005df004c72781f76062f51 (patch) | |
tree | 92f708eb81325c70c3e2827e68eb413c0c14d355 /include/linux | |
parent | cf88c79006bd6a09ad725ba0b34c0e23db20b19e (diff) |
vmalloc: implement pcpu_get_vm_areas()
To directly use spread NUMA memories for percpu units, percpu
allocator will be updated to allow sparsely mapping units in a chunk.
As the distances between units can be very large, this makes
allocating single vmap area for each chunk undesirable. This patch
implements pcpu_get_vm_areas() and pcpu_free_vm_areas() which
allocates and frees sparse congruent vmap areas.
pcpu_get_vm_areas() take @offsets and @sizes array which define
distances and sizes of vmap areas. It scans down from the top of
vmalloc area looking for the top-most address which can accomodate all
the areas. The top-down scan is to avoid interacting with regular
vmallocs which can push up these congruent areas up little by little
ending up wasting address space and page table.
To speed up top-down scan, the highest possible address hint is
maintained. Although the scan is linear from the hint, given the
usual large holes between memory addresses between NUMA nodes, the
scanning is highly likely to finish after finding the first hole for
the last unit which is scanned first.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Nick Piggin <npiggin@suse.de>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/vmalloc.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index a43ebec3a7b9..227c2a585e4f 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
@@ -115,4 +115,10 @@ extern rwlock_t vmlist_lock; | |||
115 | extern struct vm_struct *vmlist; | 115 | extern struct vm_struct *vmlist; |
116 | extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); | 116 | extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); |
117 | 117 | ||
118 | struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets, | ||
119 | const size_t *sizes, int nr_vms, | ||
120 | size_t align, gfp_t gfp_mask); | ||
121 | |||
122 | void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms); | ||
123 | |||
118 | #endif /* _LINUX_VMALLOC_H */ | 124 | #endif /* _LINUX_VMALLOC_H */ |