[Tarantool-patches] [PATCH 09/10] port: make port_c_entry not PACKED

Cyrill Gorcunov gorcunov at gmail.com
Mon Jun 8 17:04:50 MSK 2020


On Thu, May 21, 2020 at 10:37:32PM +0200, Vladislav Shpilevoy wrote:
> PACKED structures don't have padding between their members and
> after the structure (needed to be able to store them in an array).
> 
> Port_c_entry was PACKED, since it does not have padding between
> its members anyway, and the padding in the end was not needed,
> because these objects are never stored in an array. As a result,
> sizeof(port_c_entry) was not aligned too.
> 
> Appeared, that mempool, used to allocate port_c_entry objects,
> can't work correctly, when object size is not aligned at least by
> 8 bytes. Because mempool does not do any alignment internally, and
> uses the free objects as a temporary storage for some metadata,
> requiring 8 byte alignment.
> 
> The patch removes PACKED attribute from port_c_entry, so now its
> size is aligned by 8 bytes, and mempool works fine.
> 
> Part of #4609
Reviewed-by: Cyrill Gorcunov <gorcunov at gmail.com>


More information about the Tarantool-patches mailing list