All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Chandra Seetharaman <sekharan@us.ibm.com>,
	linux-kernel@vger.kernel.org, lse-tech@lists.sourceforge.net
Subject: Re: [Lse-tech] Subject: [RFC][PATCH] Fix for unsafe notifier chain mechanism
Date: Sat, 12 Nov 2005 11:28:09 -0800	[thread overview]
Message-ID: <20051112192809.GA5296@us.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0511121029450.30363-100000@netrider.rowland.org>

On Sat, Nov 12, 2005 at 10:35:07AM -0500, Alan Stern wrote:
> On Fri, 11 Nov 2005, Paul E. McKenney wrote:
> 
> > > > > +	down_write(&nh->rwsem);
> > > > > +	nl = &nh->head;
> > > > > +	while ((*nl) != NULL) {
> > > > > +		if (n->priority > (*nl)->priority)
> > > > > +			break;
> > > > > +		nl = &((*nl)->next);
> > > > > +	}
> > > > > +	rcu_assign_pointer(n->next, *nl);
> > > > 
> > > > The above can simply be "n->next = *nl;".  The reason is that this change
> > > > of state is not visible to RCU readers until after the following statement,
> > > > and it therefore need not be an RCU-reader-safe assignment.  You only need
> > > > to use rcu_assign_pointer() when the results of the assignment are
> > > > immediately visible to RCU readers.
> > > 
> > > Correct, the rcu call isn't really needed.  It doesn't hurt perceptibly,
> > > though, and part of the RCU documentation states:
> > > 
> > >  * ...  More importantly, this
> > >  * call documents which pointers will be dereferenced by RCU read-side
> > >  * code.
> > > 
> > > For that reason, I felt it was worth putting it in.
> > 
> > But the following statement does a much better job of documenting the
> > pointer that is to be RCU-dereferenced.  Duplicate documentation can
> > be just as confusing as no documentation.
> 
> It's not really duplicate documentation since _both_ pointers are to be 
> RCU-dereferenced.  But maybe you mean that only the second pointer can be 
> RCU-dereferenced at the time the write occurs?  I don't think that's what 
> the documentation comment intended.

I am the guy who wrote that documentation ocmment.  ;-)

							Thanx, Paul

  reply	other threads:[~2005-11-12 19:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-11 23:43 Subject: [RFC][PATCH] Fix for unsafe notifier chain mechanism Chandra Seetharaman
2005-11-12  1:44 ` [Lse-tech] " Paul E. McKenney
2005-11-12  2:30   ` Chandra Seetharaman
2005-11-12  2:36   ` Alan Stern
2005-11-12  5:22     ` Paul E. McKenney
2005-11-12 15:35       ` Alan Stern
2005-11-12 19:28         ` Paul E. McKenney [this message]
2005-11-12 21:01           ` Alan Stern
2005-11-12 22:38             ` Paul E. McKenney
2005-11-13 16:47               ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051112192809.GA5296@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lse-tech@lists.sourceforge.net \
    --cc=sekharan@us.ibm.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.