Netdev List
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: yoshfuji@linux-ipv6.org (YOSHIFUJI Hideaki / ????)
Cc: davem@davemloft.net, netdev@vger.kernel.org, yoshfuji@linux-ipv6.org
Subject: Re: [RFC PATCH] [IPV6] ADDRCONF: Convert addrconf_lock to RCU.
Date: Fri, 05 May 2006 14:08:21 +1000	[thread overview]
Message-ID: <E1Fbrc5-0002L7-00@gondolin.me.apana.org.au> (raw)
In-Reply-To: <20060505.122452.46183936.yoshfuji@linux-ipv6.org>

YOSHIFUJI Hideaki / ???? <yoshfuji@linux-ipv6.org> wrote:
>
> @@ -2291,10 +2287,9 @@ static int addrconf_ifdown(struct net_de
>                   Do not dev_put!
>         */
>        if (how == 1) {
> -               write_lock_bh(&addrconf_lock);
> -               dev->ip6_ptr = NULL;
> -               idev->dead = 1;
> -               write_unlock_bh(&addrconf_lock);
> +               set_wmb(idev->dead, 1);
> +               /* protected by rtnl_lock */
> +               rcu_assign_pointer(dev->ip6_ptr, NULL);

A pet peeve of mine: As a general rule you do not need to use
rcu_assign_pointer when clearing an RCU pointer.  The whole point
of that construct is to place a barrier between initialising an
object and assigning the address of that object to the pointer.
Since the object pointed to by NULL requires no initialisation, you
don't need the barrier.

I'd also like to know the purpose of the wmb after idev->dead = 1.

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

  reply	other threads:[~2006-05-05  4:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-05  3:24 [RFC PATCH] [IPV6] ADDRCONF: Convert addrconf_lock to RCU YOSHIFUJI Hideaki / 吉藤英明
2006-05-05  4:08 ` Herbert Xu [this message]
2006-05-06  0:40 ` David S. Miller
2006-05-06  1:43   ` YOSHIFUJI Hideaki / 吉藤英明

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=E1Fbrc5-0002L7-00@gondolin.me.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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