diff options
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | 2018-05-29 17:13:05 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-06-18 15:08:56 +0200 |
commit | c58bc7e236c0296c2d5afe9d1e060d53fdc4e80c (patch) | |
tree | b9923d4ecc99168f1d928ed492ca51ed06cc3507 | |
parent | mpmc_ptr_ring: Reduce the memory barrier usage (diff) | |
download | wireguard-monolithic-historical-c58bc7e236c0296c2d5afe9d1e060d53fdc4e80c.tar.xz wireguard-monolithic-historical-c58bc7e236c0296c2d5afe9d1e060d53fdc4e80c.zip |
mpmc_ptr_ring: Eliminate false sharing in struct mpmc_ptr_ring
-rw-r--r-- | src/mpmc_ptr_ring.h | 6 |
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) |