qsbr: save two full smp_mb() when the writer is also a reader.
authorPierre Habouzit <madcoder@debian.org>
Thu, 17 Sep 2009 12:30:19 +0000 (08:30 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 17 Sep 2009 12:30:19 +0000 (08:30 -0400)
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 <madcoder@debian.org>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
urcu-qsbr.c

index 4da10d6121e3d6518315e601c40ced1ec284875b..3f21be3160731979b6f39455b1202ccf00849237 100644 (file)
@@ -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();
 }
 
 /*
This page took 0.02568 seconds and 4 git commands to generate.