From 8f50d1ce191ad5f85384c0afbf1ac5b7516ea79f Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Thu, 17 Sep 2009 08:30:19 -0400 Subject: [PATCH] qsbr: save two full smp_mb() when the writer is also a reader. Now that you've put the barriers before taking lock, and after releasing it, one can expand the _rcu_thread_{on,off}line call, and optimize two barrier calls away. (this is patch 1/2). Signed-off-by: Pierre Habouzit Signed-off-by: Mathieu Desnoyers --- urcu-qsbr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/urcu-qsbr.c b/urcu-qsbr.c index 4da10d6..3f21be3 100644 --- a/urcu-qsbr.c +++ b/urcu-qsbr.c @@ -148,18 +148,18 @@ void synchronize_rcu(void) * our own quiescent state. This allows using synchronize_rcu() in * threads registered as readers. */ + smp_mb(); if (was_online) - _rcu_thread_offline(); + STORE_SHARED(rcu_reader_qs_gp, 0); - smp_mb(); internal_urcu_lock(); STORE_SHARED(urcu_gp_ctr, urcu_gp_ctr + 2); wait_for_quiescent_state(); internal_urcu_unlock(); - smp_mb(); if (was_online) - _rcu_thread_online(); + _STORE_SHARED(rcu_reader_qs_gp, LOAD_SHARED(urcu_gp_ctr) + 1); + smp_mb(); } /* -- 2.34.1