From bd1a5e15ab6d3e42be1af622bbc53a30f5ae3769 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 28 Sep 2009 23:34:52 -0400 Subject: [PATCH] Align registry data on cache line size Signed-off-by: Mathieu Desnoyers --- urcu-qsbr-static.h | 4 +++- urcu-static.h | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/urcu-qsbr-static.h b/urcu-qsbr-static.h index 1cac56c..8735c7f 100644 --- a/urcu-qsbr-static.h +++ b/urcu-qsbr-static.h @@ -184,8 +184,10 @@ static inline void reader_barrier() extern unsigned long urcu_gp_ctr; struct urcu_reader { + /* Data used by both reader and synchronize_rcu() */ unsigned long ctr; - struct list_head head; + /* Data used for registry */ + struct list_head head __attribute__((aligned(CACHE_LINE_SIZE))); pthread_t tid; }; diff --git a/urcu-static.h b/urcu-static.h index f2a463c..3b7ea32 100644 --- a/urcu-static.h +++ b/urcu-static.h @@ -220,10 +220,12 @@ static inline void reader_barrier() extern long urcu_gp_ctr; struct urcu_reader { + /* Data used by both reader and synchronize_rcu() */ long ctr; - struct list_head head; - pthread_t tid; char need_mb; + /* Data used for registry */ + struct list_head head __attribute__((aligned(CACHE_LINE_SIZE))); + pthread_t tid; }; extern struct urcu_reader __thread urcu_reader; -- 2.34.1