Skip to content

Commit

Permalink
net: rtnetlink: convert rcu_assign_pointer to RCU_INIT_POINTER
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yajun Deng authored and David S. Miller committed Sep 19, 2021
1 parent 9ce4e3d commit 4fc2998
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 4fc2998

Please sign in to comment.