net: rtnetlink: convert rcu_assign_pointer to RCU_INIT_POINTER
Subsystems (2)
PATCH 1/1 net: rtnetlink: convert rcu_assign_pointer to RCU_INIT_POINTER
It no need barrier when assigning a NULL value to an RCU protected pointer. So use RCU_INIT_POINTER() instead for more fast.
--- net/core/rtnetlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/rtnetlink.c +2 -2
@@ -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 ();
Signature · 1 line
2.32.0
This patch was applied to netdev/net-next.git (refs/heads/master):
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
Quoted 7 lines · 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 <[email protected]>--- 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
Quoted 23 lines · 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 <[email protected]>--- net/core/rtnetlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/core/rtnetlink.c +1
-1@@ -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);
net/core/rtnetlink.c void rtnl_unregister_all(int protocol) · line 343
Quoted 8 lines
net/core/rtnetlink.c +1
-1@@ -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.