• Andres Freund's avatar
    Reduce size of common allocation header. · 7e3aa03b
    Andres Freund authored
    The new slab allocator needs different per-allocation information than
    the classical aset.c.  The definition in 58b25e98 wasn't sufficiently
    careful on 32 platforms with 8 byte alignment, leading to buildfarm
    failures.  That's not entirely easy to fix by just adjusting the
    definition.
    
    As slab.c doesn't actually need the size part(s) of the common header,
    all chunks are equally sized after all, it seems better to instead
    reduce the header to the part needed by all allocators, namely which
    context an allocation belongs to. That has the advantage of reducing
    the overhead of slab allocations, and also allows for more flexibility
    in future allocators.
    
    To avoid spreading the logic about accessing a chunk's context around,
    centralize it in GetMemoryChunkContext(), which allows to delete a
    good number of lines.
    
    A followup commit will revise the mmgr/README portion about
    StandardChunkHeader, and more.
    
    Author: Andres Freund
    Discussion: https://postgr.es/m/20170228074420.aazv4iw6k562mnxg@alap3.anarazel.de
    7e3aa03b
slab.c 21.7 KB