If the call_rcu thread is waiting for entries to accumulate, it is
not necessary to wake it up.  Use the BUSY flag to detect this.

Signed-off-by: Paolo Bonzini <[email protected]>
---
 urcu-call-rcu-impl.h |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/urcu-call-rcu-impl.h b/urcu-call-rcu-impl.h
index d8570e3..165956e 100644
--- a/urcu-call-rcu-impl.h
+++ b/urcu-call-rcu-impl.h
@@ -514,10 +514,12 @@ void call_rcu(struct rcu_head *head,
        head->func = func;
        crdp = get_call_rcu_data();
        cds_wfq_enqueue(&crdp->cbs, &head->next);
-       /* Write list before writing the flags.  */
+       /* Write list before checking/writing the flags.  */
        cmm_smp_mb();
-       uatomic_or(&crdp->flags, URCU_CALL_RCU_BUSY);
-       wake_call_rcu_thread(crdp);
+       if ((uatomic_read(&crdp->flags) & URCU_CALL_RCU_BUSY) == 0) {
+               uatomic_or(&crdp->flags, URCU_CALL_RCU_BUSY);
+               wake_call_rcu_thread(crdp);
+       }
 }
 
 /*
-- 
1.7.4.4


_______________________________________________
ltt-dev mailing list
[email protected]
http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev

Reply via email to