From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Suzanne Wood <suzannew@cs.pdx.edu>,
Robert.Olsson@data.slu.se, davem@davemloft.net,
linux-kernel@vger.kernel.org, netdev@oss.sgi.com,
walpole@cs.pdx.edu
Subject: Re: [RFC][PATCH] identify in_dev_get rcu read-side critical sections
Date: Thu, 29 Sep 2005 18:16:03 -0700 [thread overview]
Message-ID: <20050930011603.GT8177@us.ibm.com> (raw)
In-Reply-To: <20050930010404.GA21429@gondor.apana.org.au>
On Fri, Sep 30, 2005 at 11:04:04AM +1000, Herbert Xu wrote:
> On Thu, Sep 29, 2005 at 05:36:42PM -0700, Paul E. McKenney wrote:
> >
> > > rcu_read_lock();
> > > in_dev = dev->ip_ptr;
> > > if (in_dev) {
> > > in_dev = rcu_dereference(in_dev);
> > > atomic_inc(&in_dev->refcnt);
> > > }
> > > rcu_read_unlock();
> > > return in_dev;
> >
> > How about:
> >
> > rcu_read_lock();
> > in_dev = dev->ip_ptr;
> > if (rcu_dereference(in_dev)) {
> > atomic_inc(&in_dev->refcnt);
> > }
> > rcu_read_unlock();
> > return in_dev;
>
> With this the barrier will taken even when in_dev is NULL.
>
> I agree this isn't such a big deal since it only impacts Alpha and then
> only when in_dev is NULL. But as we already do the branch anyway to
> increment the reference count, we might as well make things a little
> better for Alpha.
OK, how about this instead?
rcu_read_lock();
in_dev = dev->ip_ptr;
if (in_dev) {
atomic_inc(&rcu_dereference(in_dev)->refcnt);
}
rcu_read_unlock();
return in_dev;
Thanx, Paul
next prev parent reply other threads:[~2005-09-30 1:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200509292330.j8TNUSmH019572@rastaban.cs.pdx.edu>
2005-09-30 0:21 ` [RFC][PATCH] identify in_dev_get rcu read-side critical sections Herbert Xu
2005-09-30 0:23 ` Paul E. McKenney
2005-09-30 0:27 ` Herbert Xu
[not found] ` <20050930002719.GC21062@gondor.apana.org.au>
2005-09-30 0:36 ` Paul E. McKenney
[not found] ` <20050930003642.GQ8177@us.ibm.com>
2005-09-30 1:04 ` Herbert Xu
[not found] ` <20050930010404.GA21429@gondor.apana.org.au>
2005-09-30 1:16 ` Paul E. McKenney [this message]
2005-09-30 1:19 ` Herbert Xu
[not found] <200510011837.j91IbE01012915@rastaban.cs.pdx.edu>
2005-10-01 19:29 ` Herbert Xu
2005-10-01 18:37 Suzanne Wood
-- strict thread matches above, loose matches on Subject: below --
2005-10-01 18:00 Suzanne Wood
[not found] <200510010656.j916ufhT007410@rastaban.cs.pdx.edu>
2005-10-01 7:12 ` Herbert Xu
[not found] ` <20051001071248.GA15990@gondor.apana.org.au>
2005-10-01 18:04 ` Paul E. McKenney
2005-10-01 6:56 Suzanne Wood
2005-09-30 1:06 Suzanne Wood
2005-10-01 1:13 ` Herbert Xu
[not found] <200509292359.j8TNxuxD019838@rastaban.cs.pdx.edu>
2005-09-30 0:23 ` Herbert Xu
2005-09-29 23:59 Suzanne Wood
2005-09-29 23:39 Suzanne Wood
2005-09-29 23:30 Suzanne Wood
[not found] <200509291602.j8TG2TuI015920@rastaban.cs.pdx.edu>
2005-09-29 21:28 ` Herbert Xu
2005-09-29 16:02 Suzanne Wood
[not found] <20050927.135626.88296134.davem@davemloft.net>
2005-09-28 2:55 ` Herbert Xu
[not found] ` <E1EKS6j-0006s4-00@gondolin.me.apana.org.au>
2005-09-28 14:51 ` Paul E. McKenney
[not found] ` <20050928145110.GA4925@us.ibm.com>
2005-09-28 22:11 ` Herbert Xu
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=20050930011603.GT8177@us.ibm.com \
--to=paulmck@us.ibm.com \
--cc=Robert.Olsson@data.slu.se \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@oss.sgi.com \
--cc=suzannew@cs.pdx.edu \
--cc=walpole@cs.pdx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).