[ovs-dev] [PATCH 1/2] ovs-thread: Make struct spin lock cache aligned.

William Tu u9012063 at gmail.com
Mon Aug 26 23:00:31 UTC 2019


Make the spin lock struct 64-byte aligned to avoid false sharing issue.

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

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. */
 };
-- 
2.7.4



More information about the dev mailing list