• Andres Freund's avatar
    Align buffer descriptors to cache line boundaries. · ed127002
    Andres Freund authored
    Benchmarks has shown that aligning the buffer descriptor array to
    cache lines is important for scalability; especially on bigger,
    multi-socket, machines.
    
    Currently the array sometimes already happens to be aligned by
    happenstance, depending how large previous shared memory allocations
    were. That can lead to wildly varying performance results after minor
    configuration changes.
    
    In addition to aligning the start of descriptor array, also force the
    size of individual descriptors to be of a common cache line size (64
    bytes). That happens to already be the case on 64bit platforms, but
    this way we can change the struct BufferDesc more easily.
    
    As the alignment primarily matters in highly concurrent workloads
    which probably all are 64bit these days, and the space wastage of
    element alignment would be a bit more noticeable on 32bit systems, we
    don't force the stride to be cacheline sized on 32bit platforms for
    now. If somebody does actual performance testing, we can reevaluate
    that decision by changing the definition of BUFFERDESC_PADDED_SIZE.
    
    Discussion: 20140202151319.GD32123@awork2.anarazel.de
    
    Per discussion with Bruce Momjan, Tom Lane, Robert Haas, and Peter
    Geoghegan.
    ed127002
freelist.c 19.3 KB