[lttng-dev] Question about lock in synchronize_rcu implementation of URCU
Paul E. McKenney
paulmck at linux.vnet.ibm.com
Thu Apr 28 04:23:27 UTC 2016
Try building without it and see what happens when you run the tests.
Might well be that it is unnecessary, but I will defer to Mathieu
on that point.
Thanx, Paul
On Wed, Apr 27, 2016 at 10:18:04PM -0400, Yuxin Ren wrote:
> As they don't currently perform grace period, why do we use the rcu_gp_lock?
>
> Thank you.
> Yuxin
>
> 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