aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>2018-07-01 05:28:37 +0200
committerJonathan Neuschäfer <j.neuschaefer@gmx.net>2018-07-01 05:31:58 +0200
commit33794857f8fe95e3165cbd9cf1049f2c26c1b6e5 (patch)
tree949f6249294334bb460ec687cb6844e7e9de1cf8
parentmpmc_ptr_ring: reduce the memory barrier usage (diff)
downloadwireguard-monolithic-historical-33794857f8fe95e3165cbd9cf1049f2c26c1b6e5.tar.xz
wireguard-monolithic-historical-33794857f8fe95e3165cbd9cf1049f2c26c1b6e5.zip
mpmc_ptr_ring: eliminate false sharing in struct mpmc_ptr_ring
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
-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)