Subject: Re: [RFC PATCH 1/2] SCTP: Add RCU synchronization around sctp_localaddr_list

From: "Paul E. McKenney" <[email-masked]>
Date: Wed, 12 Sep 2007 08:20:58 -0700

On Tue, Sep 11, 2007 at 10:05:10AM -0400, Vlad Yasevich wrote:
> Sridhar, Paul
> 
> Thanks for review.  Some answers and questions below...

NP!

> Sridhar Samudrala wrote:
> > Paul E. McKenney wrote:

[ . . . ]

> >>>                  if ((PF_INET == sk->sk_family) &&
> >>>                      (AF_INET6 == addr->a.sa.sa_family))
> >>>                      continue;
> >>> +
> >>>                  cnt++;
> >>>              }
> >>> +            rcu_read_unlock();
> >>
> >> We are just counting these things, right?  If on the other hand we are
> >> keeping a reference outside of rcu_read_lock() protection, then there
> >> needs to be some explicit mechanism preventing the corresponding entry
> >> from being freed.
> 
> In this particular case, we are just counting.  There are other cases,
> we make a copy of the address in the list.  The goal was to reduce the
> probability that an address that is about to be deleted at the rcu
> quiescent state will not be copied/counted.
> 
> My other thought was to use atomics, but with all the yelling about atomic_read(),
> that didn't seem any better then a simple __u8 flag.

If just counting, then no worries either way.  As long as you are counting
to a local variable, as in fact you are.

							Thanx, Paul