[ovs-dev] [PATCH] cmap: Use PADDED_MEMBERS macro for cmap_bucket padding.
Ben Pfaff
blp at ovn.org
Thu Nov 30 17:42:03 UTC 2017
On Thu, Nov 30, 2017 at 03:55:03PM +0300, Ilya Maximets wrote:
> Current implementation of manual padding inside struct cmap_bucket
> doesn't work for some cacheline sizes. For example, if CACHE_LINE_SIZE
> equals to 128, compiler adds an additional 8 bytes: 4 bytes between
> 'hashes' and 'nodes' and 4 bytes after the manual 'pad'. This leads to
> build time assertion, because sizeof(struct cmap_bucket) == 136.
>
> Fix that by using PADDED_MEMBERS macro, which will handle all the
> unexpected compiler paddings.
> This is safe because we still have build time assert for the structure
> size. Other possible solution is to pack the structure, but the padding
> marco looks better and matches the other code.
>
> Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
Thanks, applied to master.
I've heard a few mentions of non-64-byte cache lines lately. Is this
hypothetical or are you working with a system that has larger (or
smaller) cache lines?
More information about the dev
mailing list