• Tejun Heo's avatar
    vmalloc: implement pcpu_get_vm_areas() · ca23e405
    Tejun Heo authored
    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: default avatarTejun Heo <tj@kernel.org>
    Cc: Nick Piggin <npiggin@suse.de>
    ca23e405
vmalloc.c 54.5 KB