• Nick Piggin's avatar
    slqb: dynamic array allocations · 50ed9354
    Nick Piggin authored
    Implement dynamic allocation for SLQB per-cpu and per-node arrays. This
    should hopefully have minimal runtime performance impact, because although
    there is an extra level of indirection to do allocations, the pointer should
    be in the cache hot area of the struct kmem_cache.
    
    It's not quite possible to use dynamic percpu allocator for this: firstly,
    that subsystem uses the slab allocator. Secondly, it doesn't have good
    support for per-node data. If those problems were improved, we could use it.
    For now, just implement a very very simple allocator until the kmalloc
    caches are up.
    
    On x86-64 with a NUMA MAXCPUS config, sizes look like this:
       text    data     bss     dec     hex filename
      29960  259565     100  289625   46b59 mm/slab.o
      34130  497130     696  531956   81df4 mm/slub.o
      24575 1634267  111136 1769978  1b01fa mm/slqb.o
      24845   13959     712   39516    9a5c mm/slqb.o + this patch
    
    SLQB is now 2 orders of magnitude smaller than it was, and an order of
    magnitude smaller than SLAB or SLUB (in total size -- text size has
    always been smaller). So it should now be very suitable for distro-type
    configs in this respect.
    
    As a side-effect the UP version of cpu_slab (which is embedded directly
    in the kmem_cache struct) moves up to the hot cachelines, so it need no
    longer be cacheline aligned on UP. The overall result should be a
    reduction in cacheline footprint on UP kernels.
    Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
    Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
    50ed9354
slqb.c 80.8 KB