[ovs-dev,1/2] ovs-thread: Make struct spin lock cache aligned.
diff mbox series

Message ID 1566860431-12795-1-git-send-email-u9012063@gmail.com
State New
Headers show
Series
  • [ovs-dev,1/2] ovs-thread: Make struct spin lock cache aligned.
Related show

Commit Message

William Tu Aug. 26, 2019, 11 p.m. UTC
Make the spin lock struct 64-byte aligned to avoid false sharing issue.

Signed-off-by: William Tu <u9012063@gmail.com>
---
 include/openvswitch/thread.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff Aug. 28, 2019, 7:10 p.m. UTC | #1
On Mon, Aug 26, 2019 at 04:00:31PM -0700, William Tu wrote:
> Make the spin lock struct 64-byte aligned to avoid false sharing issue.
> 
> Signed-off-by: William Tu <u9012063@gmail.com>

Thanks, applied to master.

Patch
diff mbox series

diff --git a/include/openvswitch/thread.h b/include/openvswitch/thread.h
index acc822904847..5053cb3091c3 100644
--- a/include/openvswitch/thread.h
+++ b/include/openvswitch/thread.h
@@ -34,7 +34,7 @@  struct OVS_LOCKABLE ovs_mutex {
 };
 
 #ifdef HAVE_PTHREAD_SPIN_LOCK
-struct OVS_LOCKABLE ovs_spin {
+OVS_ALIGNED_STRUCT(64, OVS_LOCKABLE ovs_spin) {
     pthread_spinlock_t lock;
     const char *where;          /* NULL if and only if uninitialized. */
 };