From: Sage Weil Date: Wed, 9 Nov 2016 16:12:44 +0000 (-0500) Subject: include/mempool: align shard_t to cacheline X-Git-Tag: v11.1.0~325^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ae1564df934f2c3b8213481f13ae0b9e6c4a9d2a;p=ceph.git include/mempool: align shard_t to cacheline Signed-off-by: Sage Weil --- diff --git a/src/include/mempool.h b/src/include/mempool.h index e3733f8910a4..52bce7320779 100644 --- a/src/include/mempool.h +++ b/src/include/mempool.h @@ -31,6 +31,7 @@ #include + /* Memory Pools @@ -167,10 +168,14 @@ enum { num_shards = 1 << num_shard_bits }; +// align shard to a cacheline struct shard_t { std::atomic bytes = {0}; std::atomic items = {0}; -}; + char __padding[128 - sizeof(std::atomic)*2]; +} __attribute__ ((aligned (128))); + +static_assert(sizeof(shard_t) == 128, "shard_t should be cacheline-sized"); struct stats_t { ssize_t items = 0;