Message ID | 20210918063607.23681-1-yajun.deng@linux.dev (mailing list archive) |
---|---|
State | Accepted |
Commit | 4fc29989835ab7379f807854b5f7338b752b9f1a |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] net: rtnetlink: convert rcu_assign_pointer to RCU_INIT_POINTER | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 8 maintainers not CCed: cong.wang@bytedance.com lschlesinger@drivenets.com avagin@gmail.com ryazanov.s.a@gmail.com vladimir.oltean@nxp.com dsahern@kernel.org johannes.berg@intel.com zhudi21@huawei.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 1 this patch: 1 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 16 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 1 this patch: 1 |
netdev/header_inline | success | Link |
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
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.
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();
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(-)