• Marko Mäkelä's avatar
    MDEV-24142: Avoid block_lock alignment loss on 64-bit systems · e9f33b77
    Marko Mäkelä authored
    sux_lock::recursive: Move right after the 32-bit sux_lock::lock.
    This will reduce sizeof(block_lock) from 24 to 16 bytes on
    64-bit systems with CMAKE_BUILD_TYPE=RelWithDebInfo. This may be
    significant, because there will be one buf_block_t::lock for each
    buffer pool page descriptor.
    
    We still have some potential for savings, with sizeof(buf_page_t)==112
    and sizeof(buf_block_t)==184 on a GNU/Linux AMD64 system.
    
    Note: On GNU/Linux AMD64, sizeof(index_lock) remains 32 bytes
    (16 with PLUGIN_PERFSCHEMA=NO) even tough it would fit in 24 bytes.
    This is because sizeof(srw_lock) includes 4 bytes of padding
    (to 16 bytes) that index_lock_t::recursive cannot reuse. So,
    in total 4+4 bytes will be lost to padding. This is rather
    insignificant compared to sizeof(dict_index_t)==400.
    e9f33b77
sux_lock.h 12.1 KB