[ltt-dev] [RFC PATCH 7/7] urcu:save a smp_mb_master()
Lai Jiangshan
laijs at cn.fujitsu.com
Tue Aug 16 03:58:10 EDT 2011
the second smp_mb_master() in synchronize_rcu() seems a little overkill,
but this patch adds code for reader side.
Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
urcu.c | 4 ++++
urcu/static/urcu.h | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/urcu.c b/urcu.c
index c8164a0..e6b0518 100644
--- a/urcu.c
+++ b/urcu.c
@@ -479,7 +479,11 @@ void synchronize_rcu(void)
}
/* ensure rcu_read_unlock() finish when we found the ctr==0 */
+#ifndef STRICT
+ cmm_smp_mb(); /* ensure rcu_read_unlock() finish */
+#else
smp_mb_master(RCU_MB_GROUP); /* ensure rcu_read_unlock() finish */
+#endif
out:
mutex_unlock(&rcu_gp_lock);
diff --git a/urcu/static/urcu.h b/urcu/static/urcu.h
index e4463a3..aacf6b4 100644
--- a/urcu/static/urcu.h
+++ b/urcu/static/urcu.h
@@ -345,6 +345,10 @@ static inline void _rcu_read_unlock(void)
if (tmp == 1) {
smp_mb_slave(RCU_MB_GROUP);
+#ifndef STRICT
+ if (unlikely(_CMM_LOAD_SHARED(rcu_reader.sync)))
+ cmm_smp_mb();
+#endif
rcu_reader.ctr = 0;
smp_mb_slave(RCU_MB_GROUP);
--
1.7.4.4
More information about the lttng-dev
mailing list