[ltt-dev] [PATCH 09/10] call_rcu: factor polling from RT and non-RT cases

Paolo Bonzini pbonzini at redhat.com
Wed Jun 8 04:59:17 EDT 2011


This has the additional advantage of introducing a small delay before
consecutive checks of the list.  In case call_rcu is very busy, this and
the following patch practically eliminate the difference between the RT
and non-RT version.

Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
 urcu-call-rcu-impl.h |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/urcu-call-rcu-impl.h b/urcu-call-rcu-impl.h
index 9824515..d8570e3 100644
--- a/urcu-call-rcu-impl.h
+++ b/urcu-call-rcu-impl.h
@@ -205,6 +205,7 @@ static void *call_rcu_thread(void *arg)
 	thread_call_rcu_data = crdp;
 	for (;;) {
 		for (;;) {
+			poll(NULL, 0, 10);
 			if (&crdp->cbs.head
 			    == _CMM_LOAD_SHARED(crdp->cbs.tail)) {
 				uatomic_and(&crdp->flags, ~URCU_CALL_RCU_BUSY);
@@ -237,12 +238,8 @@ static void *call_rcu_thread(void *arg)
 		cmm_smp_mb();
 		if (uatomic_read(&crdp->flags) & URCU_CALL_RCU_STOP)
 			break;
-		if (uatomic_read(&crdp->flags) & URCU_CALL_RCU_RT)
-			poll(NULL, 0, 10);
-		else {
+		if ((uatomic_read(&crdp->flags) & URCU_CALL_RCU_RT) == 0)
 			call_rcu_wait(crdp);
-			poll(NULL, 0, 10);
-		}
 	}
 	uatomic_or(&crdp->flags, URCU_CALL_RCU_STOPPED);
 	return NULL;
-- 
1.7.4.4






More information about the lttng-dev mailing list