* [PATCH net-next] net: rtnetlink: convert rcu_assign_pointer to RCU_INIT_POINTER
@ 2021-09-18 6:36 Yajun Deng
2021-09-19 12:00 ` patchwork-bot+netdevbpf
2021-09-23 17:09 ` Eric Dumazet
0 siblings, 2 replies; 3+ messages in thread
From: Yajun Deng @ 2021-09-18 6:36 UTC (permalink / raw)
To: davem, kuba; +Cc: netdev, linux-kernel, Yajun Deng
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();
--
2.32.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: rtnetlink: convert rcu_assign_pointer to RCU_INIT_POINTER
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
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-09-19 12:00 UTC (permalink / raw)
To: Yajun Deng; +Cc: davem, kuba, netdev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Sat, 18 Sep 2021 14:36:07 +0800 you 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(-)
Here is the summary with links:
- [net-next] net: rtnetlink: convert rcu_assign_pointer to RCU_INIT_POINTER
https://git.kernel.org/netdev/net-next/c/4fc29989835a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: rtnetlink: convert rcu_assign_pointer to RCU_INIT_POINTER
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
1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2021-09-23 17:09 UTC (permalink / raw)
To: Yajun Deng, davem, kuba; +Cc: netdev, linux-kernel
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-23 17:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).