From: Mathieu Desnoyers Date: Sat, 26 Sep 2009 19:10:04 +0000 (-0400) Subject: urcu-qsbr: repeat sched_yield() loop, yield at offline rather than online. X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b3c4dd1a5c12b59efdee51be209767a9f406a715;p=userspace-rcu.git urcu-qsbr: repeat sched_yield() loop, yield at offline rather than online. Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu-qsbr-static.h b/urcu-qsbr-static.h index 1cb4246..9cc5db4 100644 --- a/urcu-qsbr-static.h +++ b/urcu-qsbr-static.h @@ -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(); } diff --git a/urcu-qsbr.c b/urcu-qsbr.c index 8828ae8..c275b66 100644 --- a/urcu-qsbr.c +++ b/urcu-qsbr.c @@ -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();