aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>2018-05-29 17:13:05 +0200
committerThomas Gschwantner <tharre3@gmail.com>2018-06-22 14:52:22 +0200
commit2d7af3c72a5a657ed547c1838111a9775cdb272d (patch)
tree2be9d4be77d1d595ec3ff0d8ec97fb607772787b /src
parentmpmc_ptr_ring: Reduce the memory barrier usage (diff)
downloadwireguard-monolithic-historical-2d7af3c72a5a657ed547c1838111a9775cdb272d.tar.xz
wireguard-monolithic-historical-2d7af3c72a5a657ed547c1838111a9775cdb272d.zip
mpmc_ptr_ring: Eliminate false sharing in struct mpmc_ptr_ring
Diffstat (limited to 'src')
-rw-r--r--src/mpmc_ptr_ring.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mpmc_ptr_ring.h b/src/mpmc_ptr_ring.h
index d628ea0..2f5c4c8 100644
--- a/src/mpmc_ptr_ring.h
+++ b/src/mpmc_ptr_ring.h
@@ -40,13 +40,13 @@ struct mpmc_ptr_ring {
size_t size;
/* consumer_head: updated in dequeue; read in enqueue */
- atomic_long_t consumer_head;
+ atomic_long_t consumer_head ____cacheline_aligned_in_smp;
/* producer_head: read and updated in enqueue */
- atomic_long_t producer_head;
+ atomic_long_t producer_head ____cacheline_aligned_in_smp;
/* producer_tail: updated in enqueue, read in dequeue */
- atomic_long_t producer_tail;
+ atomic_long_t producer_tail ____cacheline_aligned_in_smp;
};
static inline bool mpmc_ptr_ring_empty(struct mpmc_ptr_ring *r)