Re: [Lse-tech] Subject: [RFC][PATCH] Fix for unsafe notifier chain mechanism

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux