From mboxrd@z Thu Jan 1 00:00:00 1970 From: compudj@krystal.dyndns.org (Mathieu Desnoyers) Date: Wed, 8 Jun 2011 18:31:07 -0400 Subject: [ltt-dev] [URCU RFC patch 2/3] call_rcu: use futex for wakeup scheme In-Reply-To: References: <20110606174558.499172848@efficios.com> <20110606175029.073385695@efficios.com> Message-ID: * Paolo Bonzini (pbonzini at redhat.com) wrote: > On 06/06/2011 07:46 PM, Mathieu Desnoyers wrote: >> +static void call_rcu_wait(struct call_rcu_data *crdp) >> +{ >> + /* Read call_rcu list before read futex */ >> + cmm_smp_mb(); >> + if (uatomic_read(&crdp->futex) == -1) >> + futex_async(&crdp->futex, FUTEX_WAIT, -1, >> + NULL, NULL, 0); >> +} >> + >> +static void call_rcu_wake_up(struct call_rcu_data *crdp) >> +{ >> + /* Write to call_rcu list before reading/writing futex */ >> + cmm_smp_mb(); >> + if (unlikely(uatomic_read(&crdp->futex) == -1)) { >> + uatomic_set(&crdp->futex, 0); >> + futex_async(&crdp->futex, FUTEX_WAKE, 1, >> + NULL, NULL, 0); >> + } >> +} > > I don't see crdp->futex ever set to -1, am I missing something obvious? Good catch! I missed those parts from the urcu.c wait/wakeup scheme (decrement initially, and also set to 0 explicitely when breaking the loop without waiting). I just added them with commit c768e45ed336970a42e58e679804f0f455422cd8 Thanks! Mathieu > > Paolo > > > _______________________________________________ > 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