]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
include/mempool: align shard_t to cacheline
authorSage Weil <sage@redhat.com>
Wed, 9 Nov 2016 16:12:44 +0000 (11:12 -0500)
committerSage Weil <sage@redhat.com>
Fri, 11 Nov 2016 19:59:53 +0000 (14:59 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/include/mempool.h

index e3733f8910a40c462c87da0645f743ce2e9785ae..52bce732077956588e8987f827b80a18a16d3879 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <common/Formatter.h>
 
+
 /*
 
 Memory Pools
@@ -167,10 +168,14 @@ enum {
   num_shards = 1 << num_shard_bits
 };
 
+// align shard to a cacheline
 struct shard_t {
   std::atomic<size_t> bytes = {0};
   std::atomic<size_t> items = {0};
-};
+  char __padding[128 - sizeof(std::atomic<size_t>)*2];
+} __attribute__ ((aligned (128)));
+
+static_assert(sizeof(shard_t) == 128, "shard_t should be cacheline-sized");
 
 struct stats_t {
   ssize_t items = 0;