[ltt-dev] [PATCH 10/10] call_rcu: avoid useless futex wakeups
Mathieu Desnoyers
compudj at krystal.dyndns.org
Thu Jun 9 10:07:58 EDT 2011
* 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 <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
>
>
> _______________________________________________
> 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
More information about the lttng-dev
mailing list