From mboxrd@z Thu Jan 1 00:00:00 1970 From: compudj@krystal.dyndns.org (Mathieu Desnoyers) Date: Thu, 9 Jun 2011 10:07:58 -0400 Subject: [ltt-dev] [PATCH 10/10] call_rcu: avoid useless futex wakeups In-Reply-To: <1307523558-16960-11-git-send-email-pbonzini@redhat.com> References: <1307523558-16960-1-git-send-email-pbonzini@redhat.com> <1307523558-16960-11-git-send-email-pbonzini@redhat.com> Message-ID: * Paolo Bonzini (pbonzini at redhat.com) wrote: > 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. The crdp->futex value being -1, I think this case is already being taken care of. Thanks, Mathieu > > 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 > > > _______________________________________________ > ltt-dev mailing list > ltt-dev at lists.casi.polymtl.ca > http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com