From mboxrd@z Thu Jan 1 00:00:00 1970 From: pbonzini@redhat.com (Paolo Bonzini) Date: Wed, 8 Jun 2011 10:59:18 +0200 Subject: [ltt-dev] [PATCH 10/10] call_rcu: avoid useless futex wakeups In-Reply-To: <1307523558-16960-1-git-send-email-pbonzini@redhat.com> References: <1307523558-16960-1-git-send-email-pbonzini@redhat.com> Message-ID: <1307523558-16960-11-git-send-email-pbonzini@redhat.com> 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 --- 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