[ltt-dev] [PATCH 10/10] call_rcu: avoid useless futex wakeups
Paolo Bonzini
pbonzini at redhat.com
Wed Jun 8 04:59:18 EDT 2011
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 <pbonzini at redhat.com>
---
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
More information about the lttng-dev
mailing list