urcu-qsbr: repeat sched_yield() loop, yield at offline rather than online.
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Sat, 26 Sep 2009 19:10:04 +0000 (15:10 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Sat, 26 Sep 2009 19:10:04 +0000 (15:10 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
urcu-qsbr-static.h
urcu-qsbr.c

index 1cb424664cbaf0502ea36d7c687f1818024d2456..9cc5db493ca1362d1781b44507a10e562623df1f 100644 (file)
@@ -239,18 +239,15 @@ static inline void _rcu_thread_offline(void)
 {
        smp_mb();
        STORE_SHARED(urcu_reader_status.qs_gp, 0);
+       if (unlikely(LOAD_SHARED(urcu_gp_ctr) & RCU_GP_ONGOING) &&
+           unlikely(urcu_reader_status.gp_waiting)) {
+               sched_yield();
+       }
 }
 
 static inline void _rcu_thread_online(void)
 {
-       long gp_ctr;
-
-       if (unlikely((gp_ctr = LOAD_SHARED(urcu_gp_ctr)) & RCU_GP_ONGOING) &&
-           unlikely(urcu_reader_status.gp_waiting)) {
-               sched_yield();
-               gp_ctr = LOAD_SHARED(urcu_gp_ctr);
-       }
-       _STORE_SHARED(urcu_reader_status.qs_gp, gp_ctr);
+       _STORE_SHARED(urcu_reader_status.qs_gp, LOAD_SHARED(urcu_gp_ctr));
        smp_mb();
 }
 
index 8828ae8ce30ed1657607a835f6a9459440a7fd21..c275b6670672de62fc76aed22ba432d6deea2b44 100644 (file)
@@ -118,6 +118,7 @@ static void wait_for_quiescent_state(void)
                while (rcu_gp_ongoing(&index->urcu_reader_status->qs_gp)) {
                        if (wait_loops++ == RCU_QS_ACTIVE_ATTEMPTS) {
                                sched_yield();  /* ideally sched_yield_to() */
+                               wait_loops = 0;
                        } else {
 #ifndef HAS_INCOHERENT_CACHES
                                cpu_relax();
This page took 0.028364 seconds and 4 git commands to generate.