From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Pavel Emelyanov <xemul@openvz.org>,
Stephen Hemminger <shemminger@linux-foundation.org>,
Linux Netdev List <netdev@vger.kernel.org>,
bridge@lists.osdl.org, devel@openvz.org, ego@in.ibm.com
Subject: Re: [PATCH (resubmit)][BRIDGE] Properly dereference the br_should_route_hook
Date: Thu, 29 Nov 2007 17:25:01 -0800 [thread overview]
Message-ID: <20071130012501.GJ9059@linux.vnet.ibm.com> (raw)
In-Reply-To: <20071129234900.GB23769@gondor.apana.org.au>
On Fri, Nov 30, 2007 at 10:49:00AM +1100, Herbert Xu wrote:
> On Thu, Nov 29, 2007 at 06:36:50AM -0800, Paul E. McKenney wrote:
> >
> > That certainly is an interesting tradeoff... Save a memory barrier
> > when assigning NULL, but pay an extra test and branch in all cases.
> > Though it does make for a simpler rule -- just use rcu_assign_pointer()
> > in all cases. Of course, if almost all rcu_assign_pointer() executions
> > assign non-NULL pointers, the optimal strategy would be to leave the
> > implementation of rcu_assign_pointer() alone, and simply enforce use
> > of rcu_assign_pointer(), even if the pointer being assigned is NULL.
>
> I was thinking of something much simpler. If the second argument is
> constant and NULL, then skip the barrier. No run-time slow-down at
> all.
That certainly makes a lot of sense!!!
You have in mind something like the following?
#define rcu_assign_pointer(p, v) \
({ \
if (!__builtin_constant_p(v) || \
((v) != NULL)) \
smp_wmb(); \
(p) = (v); \
})
If so, I will do some testing and submit a patch. Probably to Gautham's
preemptible-RCU patchset to avoid gratuitously complicating his life,
especially given that he very graciously agreed to take it over from me.
We should be able to live with the overhead in the meantime. ;-)
Thanx, Paul
> > Although rcu_dereference() does a memory barrier only on Alpha, that of
> > rcu_assign_pointer() is needed on any machine that does not preserve store
> > order (Itanium, POWER, ARM, some MIPS boxes according to rumor, ...).
>
> Good point!
>
> Thanks,
> --
> Visit Openswan at http://www.openswan.org/
> Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2007-11-30 1:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-27 16:21 [PATCH (resubmit)][BRIDGE] Properly dereference the br_should_route_hook Pavel Emelyanov
2007-11-29 13:04 ` Herbert Xu
2007-11-29 14:36 ` Paul E. McKenney
2007-11-29 23:49 ` Herbert Xu
2007-11-30 1:25 ` Paul E. McKenney [this message]
2007-11-30 2:31 ` 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=20071130012501.GJ9059@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=bridge@lists.osdl.org \
--cc=devel@openvz.org \
--cc=ego@in.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.org \
--cc=xemul@openvz.org \
/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).