Re: [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-16 Thread Joel Fernandes
On Wed, May 16, 2018 at 08:48:29AM -0700, Paul E. McKenney wrote:
> On Tue, May 15, 2018 at 04:04:30PM -0700, Joel Fernandes wrote:
> > On Mon, May 14, 2018 at 08:46:03PM -0700, Paul E. McKenney wrote:
> > > On Mon, May 14, 2018 at 05:57:09PM -0700, Joel Fernandes wrote:
> > > > On Mon, May 14, 2018 at 11:38:23AM -0700, Paul E. McKenney wrote:
> > > > > On Sun, May 13, 2018 at 08:15:39PM -0700, Joel Fernandes (Google) 
> > > > > wrote:
> > > > > > In recent discussion [1], the check for whether a leaf believes RCU 
> > > > > > is
> > > > > > not idle, is being added back to funnel locking code, to avoid more
> > > > > > locking. In this we are marking the leaf node for a future 
> > > > > > grace-period
> > > > > > and bailing out since a GP is currently in progress. However the
> > > > > > tracepoint is missing. Lets add it back.
> > > > > > 
> > > > > > Also add a small comment about why we do this check (basically the 
> > > > > > point
> > > > > > is to avoid locking intermediate nodes unnecessarily) and clarify 
> > > > > > the
> > > > > > comments in the trace event header now that we are doing traversal 
> > > > > > of
> > > > > > one or more intermediate nodes.
> > > > > > 
> > > > > > [1] 
> > > > > > http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com
> > > > > > 
> > > > > > Signed-off-by: Joel Fernandes (Google) 
> > > > > 
> > > > > Looks like a good idea, but it does not apply -- which is not a 
> > > > > surprise,
> > > > > given the change rate in this code.  I hand-applied as a modification
> > > > > to c1b3f9fce26f ("rcu: Don't funnel-lock above leaf node if GP in 
> > > > > progress")
> > > > > with attribution, but with the changes below.  Please let me know if I
> > > > > am missing something.
> > > > > 
> > > > > Ah, I see -- this commit depends on your earlier name-change commit.
> > > > > I therefore made this patch use the old names.
> > > > 
> > > > Ok, I'll check your new tree and rebase.
> > > 
> > > Sounds good!
> > > 
> > > > > > ---
> > > > > >  include/trace/events/rcu.h |  4 ++--
> > > > > >  kernel/rcu/tree.c  | 11 ++-
> > > > > >  2 files changed, 12 insertions(+), 3 deletions(-)
> > > > > > 
> > > > > > diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> > > > > > index 539900a9f8c7..dc0bd11739c7 100644
> > > > > > --- a/include/trace/events/rcu.h
> > > > > > +++ b/include/trace/events/rcu.h
> > > > > > @@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
> > > > > >   *
> > > > > >   * "Startleaf": Request a grace period based on leaf-node data.
> > > > > >   * "Prestarted": Someone beat us to the request
> > > > > > - * "Startedleaf": Leaf-node start proved sufficient.
> > > > > > - * "Startedleafroot": Leaf-node start proved sufficient after 
> > > > > > checking root.
> > > > > > + * "Startedleaf": Leaf and one or more non-root nodes marked for 
> > > > > > future start.
> > > > > 
> > > > > Actually, we only get to that trace if all we did was mark the leaf
> > > > > node, right?
> > > > 
> > > > I didn't think so. In the code we are doing the check for rnp every 
> > > > time we
> > > > walk up the tree. So even when we are on an intermediate node, we do the
> > > > check of the node we started with. I thought that's what you wanted to 
> > > > do. It
> > > > makes sense to me to do so too.
> > > 
> > > If we are not on the initial (usually leaf) node, then the similar check
> > > in the previous "if" statement would have sent us to unlock_out, right?
> > > 
> > > (And yes, I should have said "mark the initial node" above.)
> > 
> > I may have missed this, sorry. 
> > 
> > Yes, that would be true unless the check could be true not at the firsti
> > iteration, but after the first iteration? (i.e. another path started the
> > initially idle GP). That's why I changed it to "one or more non-root nodes
> > marked".
> 
> After the first iteration, the check after setting ->gp_seq_needed is
> dead code.  If that check would have succeeded, the same check in the
> big "if" statement would have taken the early exit.

Oh yes, ofcourse!! I understand it now. thanks,

 - Joel



Re: [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-16 Thread Joel Fernandes
On Wed, May 16, 2018 at 08:48:29AM -0700, Paul E. McKenney wrote:
> On Tue, May 15, 2018 at 04:04:30PM -0700, Joel Fernandes wrote:
> > On Mon, May 14, 2018 at 08:46:03PM -0700, Paul E. McKenney wrote:
> > > On Mon, May 14, 2018 at 05:57:09PM -0700, Joel Fernandes wrote:
> > > > On Mon, May 14, 2018 at 11:38:23AM -0700, Paul E. McKenney wrote:
> > > > > On Sun, May 13, 2018 at 08:15:39PM -0700, Joel Fernandes (Google) 
> > > > > wrote:
> > > > > > In recent discussion [1], the check for whether a leaf believes RCU 
> > > > > > is
> > > > > > not idle, is being added back to funnel locking code, to avoid more
> > > > > > locking. In this we are marking the leaf node for a future 
> > > > > > grace-period
> > > > > > and bailing out since a GP is currently in progress. However the
> > > > > > tracepoint is missing. Lets add it back.
> > > > > > 
> > > > > > Also add a small comment about why we do this check (basically the 
> > > > > > point
> > > > > > is to avoid locking intermediate nodes unnecessarily) and clarify 
> > > > > > the
> > > > > > comments in the trace event header now that we are doing traversal 
> > > > > > of
> > > > > > one or more intermediate nodes.
> > > > > > 
> > > > > > [1] 
> > > > > > http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com
> > > > > > 
> > > > > > Signed-off-by: Joel Fernandes (Google) 
> > > > > 
> > > > > Looks like a good idea, but it does not apply -- which is not a 
> > > > > surprise,
> > > > > given the change rate in this code.  I hand-applied as a modification
> > > > > to c1b3f9fce26f ("rcu: Don't funnel-lock above leaf node if GP in 
> > > > > progress")
> > > > > with attribution, but with the changes below.  Please let me know if I
> > > > > am missing something.
> > > > > 
> > > > > Ah, I see -- this commit depends on your earlier name-change commit.
> > > > > I therefore made this patch use the old names.
> > > > 
> > > > Ok, I'll check your new tree and rebase.
> > > 
> > > Sounds good!
> > > 
> > > > > > ---
> > > > > >  include/trace/events/rcu.h |  4 ++--
> > > > > >  kernel/rcu/tree.c  | 11 ++-
> > > > > >  2 files changed, 12 insertions(+), 3 deletions(-)
> > > > > > 
> > > > > > diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> > > > > > index 539900a9f8c7..dc0bd11739c7 100644
> > > > > > --- a/include/trace/events/rcu.h
> > > > > > +++ b/include/trace/events/rcu.h
> > > > > > @@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
> > > > > >   *
> > > > > >   * "Startleaf": Request a grace period based on leaf-node data.
> > > > > >   * "Prestarted": Someone beat us to the request
> > > > > > - * "Startedleaf": Leaf-node start proved sufficient.
> > > > > > - * "Startedleafroot": Leaf-node start proved sufficient after 
> > > > > > checking root.
> > > > > > + * "Startedleaf": Leaf and one or more non-root nodes marked for 
> > > > > > future start.
> > > > > 
> > > > > Actually, we only get to that trace if all we did was mark the leaf
> > > > > node, right?
> > > > 
> > > > I didn't think so. In the code we are doing the check for rnp every 
> > > > time we
> > > > walk up the tree. So even when we are on an intermediate node, we do the
> > > > check of the node we started with. I thought that's what you wanted to 
> > > > do. It
> > > > makes sense to me to do so too.
> > > 
> > > If we are not on the initial (usually leaf) node, then the similar check
> > > in the previous "if" statement would have sent us to unlock_out, right?
> > > 
> > > (And yes, I should have said "mark the initial node" above.)
> > 
> > I may have missed this, sorry. 
> > 
> > Yes, that would be true unless the check could be true not at the firsti
> > iteration, but after the first iteration? (i.e. another path started the
> > initially idle GP). That's why I changed it to "one or more non-root nodes
> > marked".
> 
> After the first iteration, the check after setting ->gp_seq_needed is
> dead code.  If that check would have succeeded, the same check in the
> big "if" statement would have taken the early exit.

Oh yes, ofcourse!! I understand it now. thanks,

 - Joel



Re: [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-16 Thread Paul E. McKenney
On Tue, May 15, 2018 at 04:04:30PM -0700, Joel Fernandes wrote:
> On Mon, May 14, 2018 at 08:46:03PM -0700, Paul E. McKenney wrote:
> > On Mon, May 14, 2018 at 05:57:09PM -0700, Joel Fernandes wrote:
> > > On Mon, May 14, 2018 at 11:38:23AM -0700, Paul E. McKenney wrote:
> > > > On Sun, May 13, 2018 at 08:15:39PM -0700, Joel Fernandes (Google) wrote:
> > > > > In recent discussion [1], the check for whether a leaf believes RCU is
> > > > > not idle, is being added back to funnel locking code, to avoid more
> > > > > locking. In this we are marking the leaf node for a future 
> > > > > grace-period
> > > > > and bailing out since a GP is currently in progress. However the
> > > > > tracepoint is missing. Lets add it back.
> > > > > 
> > > > > Also add a small comment about why we do this check (basically the 
> > > > > point
> > > > > is to avoid locking intermediate nodes unnecessarily) and clarify the
> > > > > comments in the trace event header now that we are doing traversal of
> > > > > one or more intermediate nodes.
> > > > > 
> > > > > [1] http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com
> > > > > 
> > > > > Signed-off-by: Joel Fernandes (Google) 
> > > > 
> > > > Looks like a good idea, but it does not apply -- which is not a 
> > > > surprise,
> > > > given the change rate in this code.  I hand-applied as a modification
> > > > to c1b3f9fce26f ("rcu: Don't funnel-lock above leaf node if GP in 
> > > > progress")
> > > > with attribution, but with the changes below.  Please let me know if I
> > > > am missing something.
> > > > 
> > > > Ah, I see -- this commit depends on your earlier name-change commit.
> > > > I therefore made this patch use the old names.
> > > 
> > > Ok, I'll check your new tree and rebase.
> > 
> > Sounds good!
> > 
> > > > > ---
> > > > >  include/trace/events/rcu.h |  4 ++--
> > > > >  kernel/rcu/tree.c  | 11 ++-
> > > > >  2 files changed, 12 insertions(+), 3 deletions(-)
> > > > > 
> > > > > diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> > > > > index 539900a9f8c7..dc0bd11739c7 100644
> > > > > --- a/include/trace/events/rcu.h
> > > > > +++ b/include/trace/events/rcu.h
> > > > > @@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
> > > > >   *
> > > > >   * "Startleaf": Request a grace period based on leaf-node data.
> > > > >   * "Prestarted": Someone beat us to the request
> > > > > - * "Startedleaf": Leaf-node start proved sufficient.
> > > > > - * "Startedleafroot": Leaf-node start proved sufficient after 
> > > > > checking root.
> > > > > + * "Startedleaf": Leaf and one or more non-root nodes marked for 
> > > > > future start.
> > > > 
> > > > Actually, we only get to that trace if all we did was mark the leaf
> > > > node, right?
> > > 
> > > I didn't think so. In the code we are doing the check for rnp every time 
> > > we
> > > walk up the tree. So even when we are on an intermediate node, we do the
> > > check of the node we started with. I thought that's what you wanted to 
> > > do. It
> > > makes sense to me to do so too.
> > 
> > If we are not on the initial (usually leaf) node, then the similar check
> > in the previous "if" statement would have sent us to unlock_out, right?
> > 
> > (And yes, I should have said "mark the initial node" above.)
> 
> I may have missed this, sorry. 
> 
> Yes, that would be true unless the check could be true not at the firsti
> iteration, but after the first iteration? (i.e. another path started the
> initially idle GP). That's why I changed it to "one or more non-root nodes
> marked".

After the first iteration, the check after setting ->gp_seq_needed is
dead code.  If that check would have succeeded, the same check in the
big "if" statement would have taken the early exit.

Thanx, Paul

> What do you think?
> 
> thanks,
> 
> - Joel
> 



Re: [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-16 Thread Paul E. McKenney
On Tue, May 15, 2018 at 04:04:30PM -0700, Joel Fernandes wrote:
> On Mon, May 14, 2018 at 08:46:03PM -0700, Paul E. McKenney wrote:
> > On Mon, May 14, 2018 at 05:57:09PM -0700, Joel Fernandes wrote:
> > > On Mon, May 14, 2018 at 11:38:23AM -0700, Paul E. McKenney wrote:
> > > > On Sun, May 13, 2018 at 08:15:39PM -0700, Joel Fernandes (Google) wrote:
> > > > > In recent discussion [1], the check for whether a leaf believes RCU is
> > > > > not idle, is being added back to funnel locking code, to avoid more
> > > > > locking. In this we are marking the leaf node for a future 
> > > > > grace-period
> > > > > and bailing out since a GP is currently in progress. However the
> > > > > tracepoint is missing. Lets add it back.
> > > > > 
> > > > > Also add a small comment about why we do this check (basically the 
> > > > > point
> > > > > is to avoid locking intermediate nodes unnecessarily) and clarify the
> > > > > comments in the trace event header now that we are doing traversal of
> > > > > one or more intermediate nodes.
> > > > > 
> > > > > [1] http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com
> > > > > 
> > > > > Signed-off-by: Joel Fernandes (Google) 
> > > > 
> > > > Looks like a good idea, but it does not apply -- which is not a 
> > > > surprise,
> > > > given the change rate in this code.  I hand-applied as a modification
> > > > to c1b3f9fce26f ("rcu: Don't funnel-lock above leaf node if GP in 
> > > > progress")
> > > > with attribution, but with the changes below.  Please let me know if I
> > > > am missing something.
> > > > 
> > > > Ah, I see -- this commit depends on your earlier name-change commit.
> > > > I therefore made this patch use the old names.
> > > 
> > > Ok, I'll check your new tree and rebase.
> > 
> > Sounds good!
> > 
> > > > > ---
> > > > >  include/trace/events/rcu.h |  4 ++--
> > > > >  kernel/rcu/tree.c  | 11 ++-
> > > > >  2 files changed, 12 insertions(+), 3 deletions(-)
> > > > > 
> > > > > diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> > > > > index 539900a9f8c7..dc0bd11739c7 100644
> > > > > --- a/include/trace/events/rcu.h
> > > > > +++ b/include/trace/events/rcu.h
> > > > > @@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
> > > > >   *
> > > > >   * "Startleaf": Request a grace period based on leaf-node data.
> > > > >   * "Prestarted": Someone beat us to the request
> > > > > - * "Startedleaf": Leaf-node start proved sufficient.
> > > > > - * "Startedleafroot": Leaf-node start proved sufficient after 
> > > > > checking root.
> > > > > + * "Startedleaf": Leaf and one or more non-root nodes marked for 
> > > > > future start.
> > > > 
> > > > Actually, we only get to that trace if all we did was mark the leaf
> > > > node, right?
> > > 
> > > I didn't think so. In the code we are doing the check for rnp every time 
> > > we
> > > walk up the tree. So even when we are on an intermediate node, we do the
> > > check of the node we started with. I thought that's what you wanted to 
> > > do. It
> > > makes sense to me to do so too.
> > 
> > If we are not on the initial (usually leaf) node, then the similar check
> > in the previous "if" statement would have sent us to unlock_out, right?
> > 
> > (And yes, I should have said "mark the initial node" above.)
> 
> I may have missed this, sorry. 
> 
> Yes, that would be true unless the check could be true not at the firsti
> iteration, but after the first iteration? (i.e. another path started the
> initially idle GP). That's why I changed it to "one or more non-root nodes
> marked".

After the first iteration, the check after setting ->gp_seq_needed is
dead code.  If that check would have succeeded, the same check in the
big "if" statement would have taken the early exit.

Thanx, Paul

> What do you think?
> 
> thanks,
> 
> - Joel
> 



Re: [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-15 Thread Joel Fernandes
On Mon, May 14, 2018 at 08:46:03PM -0700, Paul E. McKenney wrote:
> On Mon, May 14, 2018 at 05:57:09PM -0700, Joel Fernandes wrote:
> > On Mon, May 14, 2018 at 11:38:23AM -0700, Paul E. McKenney wrote:
> > > On Sun, May 13, 2018 at 08:15:39PM -0700, Joel Fernandes (Google) wrote:
> > > > In recent discussion [1], the check for whether a leaf believes RCU is
> > > > not idle, is being added back to funnel locking code, to avoid more
> > > > locking. In this we are marking the leaf node for a future grace-period
> > > > and bailing out since a GP is currently in progress. However the
> > > > tracepoint is missing. Lets add it back.
> > > > 
> > > > Also add a small comment about why we do this check (basically the point
> > > > is to avoid locking intermediate nodes unnecessarily) and clarify the
> > > > comments in the trace event header now that we are doing traversal of
> > > > one or more intermediate nodes.
> > > > 
> > > > [1] http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com
> > > > 
> > > > Signed-off-by: Joel Fernandes (Google) 
> > > 
> > > Looks like a good idea, but it does not apply -- which is not a surprise,
> > > given the change rate in this code.  I hand-applied as a modification
> > > to c1b3f9fce26f ("rcu: Don't funnel-lock above leaf node if GP in 
> > > progress")
> > > with attribution, but with the changes below.  Please let me know if I
> > > am missing something.
> > > 
> > > Ah, I see -- this commit depends on your earlier name-change commit.
> > > I therefore made this patch use the old names.
> > 
> > Ok, I'll check your new tree and rebase.
> 
> Sounds good!
> 
> > > > ---
> > > >  include/trace/events/rcu.h |  4 ++--
> > > >  kernel/rcu/tree.c  | 11 ++-
> > > >  2 files changed, 12 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> > > > index 539900a9f8c7..dc0bd11739c7 100644
> > > > --- a/include/trace/events/rcu.h
> > > > +++ b/include/trace/events/rcu.h
> > > > @@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
> > > >   *
> > > >   * "Startleaf": Request a grace period based on leaf-node data.
> > > >   * "Prestarted": Someone beat us to the request
> > > > - * "Startedleaf": Leaf-node start proved sufficient.
> > > > - * "Startedleafroot": Leaf-node start proved sufficient after checking 
> > > > root.
> > > > + * "Startedleaf": Leaf and one or more non-root nodes marked for 
> > > > future start.
> > > 
> > > Actually, we only get to that trace if all we did was mark the leaf
> > > node, right?
> > 
> > I didn't think so. In the code we are doing the check for rnp every time we
> > walk up the tree. So even when we are on an intermediate node, we do the
> > check of the node we started with. I thought that's what you wanted to do. 
> > It
> > makes sense to me to do so too.
> 
> If we are not on the initial (usually leaf) node, then the similar check
> in the previous "if" statement would have sent us to unlock_out, right?
> 
> (And yes, I should have said "mark the initial node" above.)

I may have missed this, sorry. 

Yes, that would be true unless the check could be true not at the firsti
iteration, but after the first iteration? (i.e. another path started the
initially idle GP). That's why I changed it to "one or more non-root nodes
marked".

What do you think?

thanks,

- Joel




Re: [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-15 Thread Joel Fernandes
On Mon, May 14, 2018 at 08:46:03PM -0700, Paul E. McKenney wrote:
> On Mon, May 14, 2018 at 05:57:09PM -0700, Joel Fernandes wrote:
> > On Mon, May 14, 2018 at 11:38:23AM -0700, Paul E. McKenney wrote:
> > > On Sun, May 13, 2018 at 08:15:39PM -0700, Joel Fernandes (Google) wrote:
> > > > In recent discussion [1], the check for whether a leaf believes RCU is
> > > > not idle, is being added back to funnel locking code, to avoid more
> > > > locking. In this we are marking the leaf node for a future grace-period
> > > > and bailing out since a GP is currently in progress. However the
> > > > tracepoint is missing. Lets add it back.
> > > > 
> > > > Also add a small comment about why we do this check (basically the point
> > > > is to avoid locking intermediate nodes unnecessarily) and clarify the
> > > > comments in the trace event header now that we are doing traversal of
> > > > one or more intermediate nodes.
> > > > 
> > > > [1] http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com
> > > > 
> > > > Signed-off-by: Joel Fernandes (Google) 
> > > 
> > > Looks like a good idea, but it does not apply -- which is not a surprise,
> > > given the change rate in this code.  I hand-applied as a modification
> > > to c1b3f9fce26f ("rcu: Don't funnel-lock above leaf node if GP in 
> > > progress")
> > > with attribution, but with the changes below.  Please let me know if I
> > > am missing something.
> > > 
> > > Ah, I see -- this commit depends on your earlier name-change commit.
> > > I therefore made this patch use the old names.
> > 
> > Ok, I'll check your new tree and rebase.
> 
> Sounds good!
> 
> > > > ---
> > > >  include/trace/events/rcu.h |  4 ++--
> > > >  kernel/rcu/tree.c  | 11 ++-
> > > >  2 files changed, 12 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> > > > index 539900a9f8c7..dc0bd11739c7 100644
> > > > --- a/include/trace/events/rcu.h
> > > > +++ b/include/trace/events/rcu.h
> > > > @@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
> > > >   *
> > > >   * "Startleaf": Request a grace period based on leaf-node data.
> > > >   * "Prestarted": Someone beat us to the request
> > > > - * "Startedleaf": Leaf-node start proved sufficient.
> > > > - * "Startedleafroot": Leaf-node start proved sufficient after checking 
> > > > root.
> > > > + * "Startedleaf": Leaf and one or more non-root nodes marked for 
> > > > future start.
> > > 
> > > Actually, we only get to that trace if all we did was mark the leaf
> > > node, right?
> > 
> > I didn't think so. In the code we are doing the check for rnp every time we
> > walk up the tree. So even when we are on an intermediate node, we do the
> > check of the node we started with. I thought that's what you wanted to do. 
> > It
> > makes sense to me to do so too.
> 
> If we are not on the initial (usually leaf) node, then the similar check
> in the previous "if" statement would have sent us to unlock_out, right?
> 
> (And yes, I should have said "mark the initial node" above.)

I may have missed this, sorry. 

Yes, that would be true unless the check could be true not at the firsti
iteration, but after the first iteration? (i.e. another path started the
initially idle GP). That's why I changed it to "one or more non-root nodes
marked".

What do you think?

thanks,

- Joel




Re: [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-14 Thread Paul E. McKenney
On Mon, May 14, 2018 at 05:57:09PM -0700, Joel Fernandes wrote:
> On Mon, May 14, 2018 at 11:38:23AM -0700, Paul E. McKenney wrote:
> > On Sun, May 13, 2018 at 08:15:39PM -0700, Joel Fernandes (Google) wrote:
> > > In recent discussion [1], the check for whether a leaf believes RCU is
> > > not idle, is being added back to funnel locking code, to avoid more
> > > locking. In this we are marking the leaf node for a future grace-period
> > > and bailing out since a GP is currently in progress. However the
> > > tracepoint is missing. Lets add it back.
> > > 
> > > Also add a small comment about why we do this check (basically the point
> > > is to avoid locking intermediate nodes unnecessarily) and clarify the
> > > comments in the trace event header now that we are doing traversal of
> > > one or more intermediate nodes.
> > > 
> > > [1] http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com
> > > 
> > > Signed-off-by: Joel Fernandes (Google) 
> > 
> > Looks like a good idea, but it does not apply -- which is not a surprise,
> > given the change rate in this code.  I hand-applied as a modification
> > to c1b3f9fce26f ("rcu: Don't funnel-lock above leaf node if GP in progress")
> > with attribution, but with the changes below.  Please let me know if I
> > am missing something.
> > 
> > Ah, I see -- this commit depends on your earlier name-change commit.
> > I therefore made this patch use the old names.
> 
> Ok, I'll check your new tree and rebase.

Sounds good!

> > > ---
> > >  include/trace/events/rcu.h |  4 ++--
> > >  kernel/rcu/tree.c  | 11 ++-
> > >  2 files changed, 12 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> > > index 539900a9f8c7..dc0bd11739c7 100644
> > > --- a/include/trace/events/rcu.h
> > > +++ b/include/trace/events/rcu.h
> > > @@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
> > >   *
> > >   * "Startleaf": Request a grace period based on leaf-node data.
> > >   * "Prestarted": Someone beat us to the request
> > > - * "Startedleaf": Leaf-node start proved sufficient.
> > > - * "Startedleafroot": Leaf-node start proved sufficient after checking 
> > > root.
> > > + * "Startedleaf": Leaf and one or more non-root nodes marked for future 
> > > start.
> > 
> > Actually, we only get to that trace if all we did was mark the leaf
> > node, right?
> 
> I didn't think so. In the code we are doing the check for rnp every time we
> walk up the tree. So even when we are on an intermediate node, we do the
> check of the node we started with. I thought that's what you wanted to do. It
> makes sense to me to do so too.

If we are not on the initial (usually leaf) node, then the similar check
in the previous "if" statement would have sent us to unlock_out, right?

(And yes, I should have said "mark the initial node" above.)

Thanx, Paul

> > > + * "Startedleafroot": all non-root nodes from leaf to root marked for 
> > > future start.
> > 
> > I got rid of the "non-root" part, given that we had to have marked
> > the root to break out of the loop.
> 
> Ah yes, sorry. That's absolutely true.
> 
> thanks,
> 
> - Joel
> 



Re: [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-14 Thread Paul E. McKenney
On Mon, May 14, 2018 at 05:57:09PM -0700, Joel Fernandes wrote:
> On Mon, May 14, 2018 at 11:38:23AM -0700, Paul E. McKenney wrote:
> > On Sun, May 13, 2018 at 08:15:39PM -0700, Joel Fernandes (Google) wrote:
> > > In recent discussion [1], the check for whether a leaf believes RCU is
> > > not idle, is being added back to funnel locking code, to avoid more
> > > locking. In this we are marking the leaf node for a future grace-period
> > > and bailing out since a GP is currently in progress. However the
> > > tracepoint is missing. Lets add it back.
> > > 
> > > Also add a small comment about why we do this check (basically the point
> > > is to avoid locking intermediate nodes unnecessarily) and clarify the
> > > comments in the trace event header now that we are doing traversal of
> > > one or more intermediate nodes.
> > > 
> > > [1] http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com
> > > 
> > > Signed-off-by: Joel Fernandes (Google) 
> > 
> > Looks like a good idea, but it does not apply -- which is not a surprise,
> > given the change rate in this code.  I hand-applied as a modification
> > to c1b3f9fce26f ("rcu: Don't funnel-lock above leaf node if GP in progress")
> > with attribution, but with the changes below.  Please let me know if I
> > am missing something.
> > 
> > Ah, I see -- this commit depends on your earlier name-change commit.
> > I therefore made this patch use the old names.
> 
> Ok, I'll check your new tree and rebase.

Sounds good!

> > > ---
> > >  include/trace/events/rcu.h |  4 ++--
> > >  kernel/rcu/tree.c  | 11 ++-
> > >  2 files changed, 12 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> > > index 539900a9f8c7..dc0bd11739c7 100644
> > > --- a/include/trace/events/rcu.h
> > > +++ b/include/trace/events/rcu.h
> > > @@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
> > >   *
> > >   * "Startleaf": Request a grace period based on leaf-node data.
> > >   * "Prestarted": Someone beat us to the request
> > > - * "Startedleaf": Leaf-node start proved sufficient.
> > > - * "Startedleafroot": Leaf-node start proved sufficient after checking 
> > > root.
> > > + * "Startedleaf": Leaf and one or more non-root nodes marked for future 
> > > start.
> > 
> > Actually, we only get to that trace if all we did was mark the leaf
> > node, right?
> 
> I didn't think so. In the code we are doing the check for rnp every time we
> walk up the tree. So even when we are on an intermediate node, we do the
> check of the node we started with. I thought that's what you wanted to do. It
> makes sense to me to do so too.

If we are not on the initial (usually leaf) node, then the similar check
in the previous "if" statement would have sent us to unlock_out, right?

(And yes, I should have said "mark the initial node" above.)

Thanx, Paul

> > > + * "Startedleafroot": all non-root nodes from leaf to root marked for 
> > > future start.
> > 
> > I got rid of the "non-root" part, given that we had to have marked
> > the root to break out of the loop.
> 
> Ah yes, sorry. That's absolutely true.
> 
> thanks,
> 
> - Joel
> 



Re: [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-14 Thread Joel Fernandes
On Mon, May 14, 2018 at 11:38:23AM -0700, Paul E. McKenney wrote:
> On Sun, May 13, 2018 at 08:15:39PM -0700, Joel Fernandes (Google) wrote:
> > In recent discussion [1], the check for whether a leaf believes RCU is
> > not idle, is being added back to funnel locking code, to avoid more
> > locking. In this we are marking the leaf node for a future grace-period
> > and bailing out since a GP is currently in progress. However the
> > tracepoint is missing. Lets add it back.
> > 
> > Also add a small comment about why we do this check (basically the point
> > is to avoid locking intermediate nodes unnecessarily) and clarify the
> > comments in the trace event header now that we are doing traversal of
> > one or more intermediate nodes.
> > 
> > [1] http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com
> > 
> > Signed-off-by: Joel Fernandes (Google) 
> 
> Looks like a good idea, but it does not apply -- which is not a surprise,
> given the change rate in this code.  I hand-applied as a modification
> to c1b3f9fce26f ("rcu: Don't funnel-lock above leaf node if GP in progress")
> with attribution, but with the changes below.  Please let me know if I
> am missing something.
> 
> Ah, I see -- this commit depends on your earlier name-change commit.
> I therefore made this patch use the old names.

Ok, I'll check your new tree and rebase.

> > ---
> >  include/trace/events/rcu.h |  4 ++--
> >  kernel/rcu/tree.c  | 11 ++-
> >  2 files changed, 12 insertions(+), 3 deletions(-)
> > 
> > diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> > index 539900a9f8c7..dc0bd11739c7 100644
> > --- a/include/trace/events/rcu.h
> > +++ b/include/trace/events/rcu.h
> > @@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
> >   *
> >   * "Startleaf": Request a grace period based on leaf-node data.
> >   * "Prestarted": Someone beat us to the request
> > - * "Startedleaf": Leaf-node start proved sufficient.
> > - * "Startedleafroot": Leaf-node start proved sufficient after checking 
> > root.
> > + * "Startedleaf": Leaf and one or more non-root nodes marked for future 
> > start.
> 
> Actually, we only get to that trace if all we did was mark the leaf
> node, right?

I didn't think so. In the code we are doing the check for rnp every time we
walk up the tree. So even when we are on an intermediate node, we do the
check of the node we started with. I thought that's what you wanted to do. It
makes sense to me to do so too.

> > + * "Startedleafroot": all non-root nodes from leaf to root marked for 
> > future start.
> 
> I got rid of the "non-root" part, given that we had to have marked
> the root to break out of the loop.

Ah yes, sorry. That's absolutely true.

thanks,

- Joel



Re: [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-14 Thread Joel Fernandes
On Mon, May 14, 2018 at 11:38:23AM -0700, Paul E. McKenney wrote:
> On Sun, May 13, 2018 at 08:15:39PM -0700, Joel Fernandes (Google) wrote:
> > In recent discussion [1], the check for whether a leaf believes RCU is
> > not idle, is being added back to funnel locking code, to avoid more
> > locking. In this we are marking the leaf node for a future grace-period
> > and bailing out since a GP is currently in progress. However the
> > tracepoint is missing. Lets add it back.
> > 
> > Also add a small comment about why we do this check (basically the point
> > is to avoid locking intermediate nodes unnecessarily) and clarify the
> > comments in the trace event header now that we are doing traversal of
> > one or more intermediate nodes.
> > 
> > [1] http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com
> > 
> > Signed-off-by: Joel Fernandes (Google) 
> 
> Looks like a good idea, but it does not apply -- which is not a surprise,
> given the change rate in this code.  I hand-applied as a modification
> to c1b3f9fce26f ("rcu: Don't funnel-lock above leaf node if GP in progress")
> with attribution, but with the changes below.  Please let me know if I
> am missing something.
> 
> Ah, I see -- this commit depends on your earlier name-change commit.
> I therefore made this patch use the old names.

Ok, I'll check your new tree and rebase.

> > ---
> >  include/trace/events/rcu.h |  4 ++--
> >  kernel/rcu/tree.c  | 11 ++-
> >  2 files changed, 12 insertions(+), 3 deletions(-)
> > 
> > diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> > index 539900a9f8c7..dc0bd11739c7 100644
> > --- a/include/trace/events/rcu.h
> > +++ b/include/trace/events/rcu.h
> > @@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
> >   *
> >   * "Startleaf": Request a grace period based on leaf-node data.
> >   * "Prestarted": Someone beat us to the request
> > - * "Startedleaf": Leaf-node start proved sufficient.
> > - * "Startedleafroot": Leaf-node start proved sufficient after checking 
> > root.
> > + * "Startedleaf": Leaf and one or more non-root nodes marked for future 
> > start.
> 
> Actually, we only get to that trace if all we did was mark the leaf
> node, right?

I didn't think so. In the code we are doing the check for rnp every time we
walk up the tree. So even when we are on an intermediate node, we do the
check of the node we started with. I thought that's what you wanted to do. It
makes sense to me to do so too.

> > + * "Startedleafroot": all non-root nodes from leaf to root marked for 
> > future start.
> 
> I got rid of the "non-root" part, given that we had to have marked
> the root to break out of the loop.

Ah yes, sorry. That's absolutely true.

thanks,

- Joel



Re: [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-14 Thread Paul E. McKenney
On Sun, May 13, 2018 at 08:15:39PM -0700, Joel Fernandes (Google) wrote:
> In recent discussion [1], the check for whether a leaf believes RCU is
> not idle, is being added back to funnel locking code, to avoid more
> locking. In this we are marking the leaf node for a future grace-period
> and bailing out since a GP is currently in progress. However the
> tracepoint is missing. Lets add it back.
> 
> Also add a small comment about why we do this check (basically the point
> is to avoid locking intermediate nodes unnecessarily) and clarify the
> comments in the trace event header now that we are doing traversal of
> one or more intermediate nodes.
> 
> [1] http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com
> 
> Signed-off-by: Joel Fernandes (Google) 

Looks like a good idea, but it does not apply -- which is not a surprise,
given the change rate in this code.  I hand-applied as a modification
to c1b3f9fce26f ("rcu: Don't funnel-lock above leaf node if GP in progress")
with attribution, but with the changes below.  Please let me know if I
am missing something.

Ah, I see -- this commit depends on your earlier name-change commit.
I therefore made this patch use the old names.

> ---
>  include/trace/events/rcu.h |  4 ++--
>  kernel/rcu/tree.c  | 11 ++-
>  2 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> index 539900a9f8c7..dc0bd11739c7 100644
> --- a/include/trace/events/rcu.h
> +++ b/include/trace/events/rcu.h
> @@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
>   *
>   * "Startleaf": Request a grace period based on leaf-node data.
>   * "Prestarted": Someone beat us to the request
> - * "Startedleaf": Leaf-node start proved sufficient.
> - * "Startedleafroot": Leaf-node start proved sufficient after checking root.
> + * "Startedleaf": Leaf and one or more non-root nodes marked for future 
> start.

Actually, we only get to that trace if all we did was mark the leaf
node, right?

> + * "Startedleafroot": all non-root nodes from leaf to root marked for future 
> start.

I got rid of the "non-root" part, given that we had to have marked
the root to break out of the loop.

Thanx, Paul

>   * "Startedroot": Requested a nocb grace period based on root-node data.
>   * "NoGPkthread": The RCU grace-period kthread has not yet started.
>   * "StartWait": Start waiting for the requested grace period.
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 40670047d22c..8401a253e7de 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -1593,8 +1593,17 @@ static bool rcu_start_this_gp(struct rcu_node *rnp, 
> struct rcu_data *rdp,
>   goto unlock_out;
>   }
>   rnp_node->gp_seq_needed = gp_seq_start;
> - if (rcu_seq_state(rcu_seq_current(>gp_seq)))
> +
> + /*
> +  * Check if leaf believes a GP is in progress, if yes we can
> +  * bail and avoid more locking. We have already marked the leaf.
> +  */
> + if (rcu_seq_state(rcu_seq_current(>gp_seq))) {
> + trace_rcu_this_gp(rnp_node, rdp, gp_seq_start,
> +   TPS("Startedleaf"));
>   goto unlock_out;
> + }
> +
>   if (rnp_node != rnp && rnp_node->parent != NULL)
>   raw_spin_unlock_rcu_node(rnp_node);
>   if (!rnp_node->parent) {
> -- 
> 2.17.0.441.gb46fe60e1d-goog
> 



Re: [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-14 Thread Paul E. McKenney
On Sun, May 13, 2018 at 08:15:39PM -0700, Joel Fernandes (Google) wrote:
> In recent discussion [1], the check for whether a leaf believes RCU is
> not idle, is being added back to funnel locking code, to avoid more
> locking. In this we are marking the leaf node for a future grace-period
> and bailing out since a GP is currently in progress. However the
> tracepoint is missing. Lets add it back.
> 
> Also add a small comment about why we do this check (basically the point
> is to avoid locking intermediate nodes unnecessarily) and clarify the
> comments in the trace event header now that we are doing traversal of
> one or more intermediate nodes.
> 
> [1] http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com
> 
> Signed-off-by: Joel Fernandes (Google) 

Looks like a good idea, but it does not apply -- which is not a surprise,
given the change rate in this code.  I hand-applied as a modification
to c1b3f9fce26f ("rcu: Don't funnel-lock above leaf node if GP in progress")
with attribution, but with the changes below.  Please let me know if I
am missing something.

Ah, I see -- this commit depends on your earlier name-change commit.
I therefore made this patch use the old names.

> ---
>  include/trace/events/rcu.h |  4 ++--
>  kernel/rcu/tree.c  | 11 ++-
>  2 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> index 539900a9f8c7..dc0bd11739c7 100644
> --- a/include/trace/events/rcu.h
> +++ b/include/trace/events/rcu.h
> @@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
>   *
>   * "Startleaf": Request a grace period based on leaf-node data.
>   * "Prestarted": Someone beat us to the request
> - * "Startedleaf": Leaf-node start proved sufficient.
> - * "Startedleafroot": Leaf-node start proved sufficient after checking root.
> + * "Startedleaf": Leaf and one or more non-root nodes marked for future 
> start.

Actually, we only get to that trace if all we did was mark the leaf
node, right?

> + * "Startedleafroot": all non-root nodes from leaf to root marked for future 
> start.

I got rid of the "non-root" part, given that we had to have marked
the root to break out of the loop.

Thanx, Paul

>   * "Startedroot": Requested a nocb grace period based on root-node data.
>   * "NoGPkthread": The RCU grace-period kthread has not yet started.
>   * "StartWait": Start waiting for the requested grace period.
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 40670047d22c..8401a253e7de 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -1593,8 +1593,17 @@ static bool rcu_start_this_gp(struct rcu_node *rnp, 
> struct rcu_data *rdp,
>   goto unlock_out;
>   }
>   rnp_node->gp_seq_needed = gp_seq_start;
> - if (rcu_seq_state(rcu_seq_current(>gp_seq)))
> +
> + /*
> +  * Check if leaf believes a GP is in progress, if yes we can
> +  * bail and avoid more locking. We have already marked the leaf.
> +  */
> + if (rcu_seq_state(rcu_seq_current(>gp_seq))) {
> + trace_rcu_this_gp(rnp_node, rdp, gp_seq_start,
> +   TPS("Startedleaf"));
>   goto unlock_out;
> + }
> +
>   if (rnp_node != rnp && rnp_node->parent != NULL)
>   raw_spin_unlock_rcu_node(rnp_node);
>   if (!rnp_node->parent) {
> -- 
> 2.17.0.441.gb46fe60e1d-goog
> 



[PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-13 Thread Joel Fernandes (Google)
In recent discussion [1], the check for whether a leaf believes RCU is
not idle, is being added back to funnel locking code, to avoid more
locking. In this we are marking the leaf node for a future grace-period
and bailing out since a GP is currently in progress. However the
tracepoint is missing. Lets add it back.

Also add a small comment about why we do this check (basically the point
is to avoid locking intermediate nodes unnecessarily) and clarify the
comments in the trace event header now that we are doing traversal of
one or more intermediate nodes.

[1] http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com

Signed-off-by: Joel Fernandes (Google) 
---
 include/trace/events/rcu.h |  4 ++--
 kernel/rcu/tree.c  | 11 ++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index 539900a9f8c7..dc0bd11739c7 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
  *
  * "Startleaf": Request a grace period based on leaf-node data.
  * "Prestarted": Someone beat us to the request
- * "Startedleaf": Leaf-node start proved sufficient.
- * "Startedleafroot": Leaf-node start proved sufficient after checking root.
+ * "Startedleaf": Leaf and one or more non-root nodes marked for future start.
+ * "Startedleafroot": all non-root nodes from leaf to root marked for future 
start.
  * "Startedroot": Requested a nocb grace period based on root-node data.
  * "NoGPkthread": The RCU grace-period kthread has not yet started.
  * "StartWait": Start waiting for the requested grace period.
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 40670047d22c..8401a253e7de 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1593,8 +1593,17 @@ static bool rcu_start_this_gp(struct rcu_node *rnp, 
struct rcu_data *rdp,
goto unlock_out;
}
rnp_node->gp_seq_needed = gp_seq_start;
-   if (rcu_seq_state(rcu_seq_current(>gp_seq)))
+
+   /*
+* Check if leaf believes a GP is in progress, if yes we can
+* bail and avoid more locking. We have already marked the leaf.
+*/
+   if (rcu_seq_state(rcu_seq_current(>gp_seq))) {
+   trace_rcu_this_gp(rnp_node, rdp, gp_seq_start,
+ TPS("Startedleaf"));
goto unlock_out;
+   }
+
if (rnp_node != rnp && rnp_node->parent != NULL)
raw_spin_unlock_rcu_node(rnp_node);
if (!rnp_node->parent) {
-- 
2.17.0.441.gb46fe60e1d-goog



[PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint

2018-05-13 Thread Joel Fernandes (Google)
In recent discussion [1], the check for whether a leaf believes RCU is
not idle, is being added back to funnel locking code, to avoid more
locking. In this we are marking the leaf node for a future grace-period
and bailing out since a GP is currently in progress. However the
tracepoint is missing. Lets add it back.

Also add a small comment about why we do this check (basically the point
is to avoid locking intermediate nodes unnecessarily) and clarify the
comments in the trace event header now that we are doing traversal of
one or more intermediate nodes.

[1] http://lkml.kernel.org/r/20180513190906.gl26...@linux.vnet.ibm.com

Signed-off-by: Joel Fernandes (Google) 
---
 include/trace/events/rcu.h |  4 ++--
 kernel/rcu/tree.c  | 11 ++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index 539900a9f8c7..dc0bd11739c7 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period,
  *
  * "Startleaf": Request a grace period based on leaf-node data.
  * "Prestarted": Someone beat us to the request
- * "Startedleaf": Leaf-node start proved sufficient.
- * "Startedleafroot": Leaf-node start proved sufficient after checking root.
+ * "Startedleaf": Leaf and one or more non-root nodes marked for future start.
+ * "Startedleafroot": all non-root nodes from leaf to root marked for future 
start.
  * "Startedroot": Requested a nocb grace period based on root-node data.
  * "NoGPkthread": The RCU grace-period kthread has not yet started.
  * "StartWait": Start waiting for the requested grace period.
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 40670047d22c..8401a253e7de 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1593,8 +1593,17 @@ static bool rcu_start_this_gp(struct rcu_node *rnp, 
struct rcu_data *rdp,
goto unlock_out;
}
rnp_node->gp_seq_needed = gp_seq_start;
-   if (rcu_seq_state(rcu_seq_current(>gp_seq)))
+
+   /*
+* Check if leaf believes a GP is in progress, if yes we can
+* bail and avoid more locking. We have already marked the leaf.
+*/
+   if (rcu_seq_state(rcu_seq_current(>gp_seq))) {
+   trace_rcu_this_gp(rnp_node, rdp, gp_seq_start,
+ TPS("Startedleaf"));
goto unlock_out;
+   }
+
if (rnp_node != rnp && rnp_node->parent != NULL)
raw_spin_unlock_rcu_node(rnp_node);
if (!rnp_node->parent) {
-- 
2.17.0.441.gb46fe60e1d-goog