From: Eric Dumazet <eric.dumazet@gmail.com>
To: Yajun Deng <yajun.deng@linux.dev>, davem@davemloft.net, kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: rtnetlink: convert rcu_assign_pointer to RCU_INIT_POINTER
Date: Thu, 23 Sep 2021 10:09:25 -0700 [thread overview]
Message-ID: <94c26a4b-4a39-fcc8-60e4-880fe80c4443@gmail.com> (raw)
In-Reply-To: <20210918063607.23681-1-yajun.deng@linux.dev>
On 9/17/21 11:36 PM, Yajun Deng wrote:
> It no need barrier when assigning a NULL value to an RCU protected
> pointer. So use RCU_INIT_POINTER() instead for more fast.
>
> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
> ---
> net/core/rtnetlink.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 972c8cb303a5..327ca6bc6e6d 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -301,7 +301,7 @@ int rtnl_unregister(int protocol, int msgtype)
> }
>
> link = rtnl_dereference(tab[msgindex]);
> - rcu_assign_pointer(tab[msgindex], NULL);
> + RCU_INIT_POINTER(tab[msgindex], NULL);
> rtnl_unlock();
>
> kfree_rcu(link, rcu);
> @@ -337,7 +337,7 @@ void rtnl_unregister_all(int protocol)
> if (!link)
> continue;
>
> - rcu_assign_pointer(tab[msgindex], NULL);
> + RCU_INIT_POINTER(tab[msgindex], NULL);
> kfree_rcu(link, rcu);
> }
> rtnl_unlock();
>
FYI, there is no memory barrier involved in
rcu_assign_pointer(tab[msgindex], NULL);
This has been the case for the last 5 years.
Your patch was not needed really.
prev parent reply other threads:[~2021-09-23 17:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-18 6:36 [PATCH net-next] net: rtnetlink: convert rcu_assign_pointer to RCU_INIT_POINTER Yajun Deng
2021-09-19 12:00 ` patchwork-bot+netdevbpf
2021-09-23 17:09 ` Eric Dumazet [this message]
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=94c26a4b-4a39-fcc8-60e4-880fe80c4443@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yajun.deng@linux.dev \
/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).