[lttng-dev] Question about lock in synchronize_rcu implementation of URCU

Yuxin Ren ryx at gwmail.gwu.edu
Thu Apr 28 02:18:04 UTC 2016

As they don't currently perform grace period, why do we use the rcu_gp_lock?

Thank you.

On Wed, Apr 27, 2016 at 10:08 PM, Paul E. McKenney
<paulmck at linux.vnet.ibm.com> wrote:
> On Wed, Apr 27, 2016 at 09:34:16PM -0400, Yuxin Ren wrote:
>> Hi,
>> I am learning the URCU code.
>> Why do we need rcu_gp_lock in synchronize_rcu?
>> https://github.com/urcu/userspace-rcu/blob/master/urcu.c#L401
>> In the comment, it says this lock ensures mutual exclusion between
>> threads calling synchronize_rcu().
>> But only the first thread added to waiter queue can proceed to detect
>> grace period.
>> How can multiple threads currently perform the grace thread?
> They don't concurrently perform grace periods, and it would be wasteful
> for them to do so.  Instead, the first one performs the grace period,
> and all that were waiting at the time it started get the benefit of that
> same grace period.
> Any that arrived after the first grace period performs the first
> grace period are served by whichever of them performs the second
> grace period.
>                                                         Thanx, Paul

More information about the lttng-dev mailing list