Message ID | 1fc15c8b-ba1c-a1d9-d204-8087d93b73e3@163.com |
---|---|
State | Superseded, archived |
Delegated to: | Paolo Abeni |
Headers | show |
Series | mptcp: remove redundant couters reset in pm_nl_init_net() | expand |
On Thu, 2021-04-22 at 15:03 +0800, Jianguo Wu wrote: > From: Jianguo Wu <wujianguo@chinatelecom.cn> > > Memory of struct pm_nl_pernet{} is allocated by kzalloc() > in setup_net()->ops_init(), so it's no need to reset counters > in pm_nl_init_net(). > > Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn> > --- > net/mptcp/pm_netlink.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c > index 6ba0408..99bb9be 100644 > --- a/net/mptcp/pm_netlink.c > +++ b/net/mptcp/pm_netlink.c > @@ -1913,7 +1913,6 @@ static int __net_init pm_nl_init_net(struct net *net) > struct pm_nl_pernet *pernet = net_generic(net, pm_nl_pernet_id); > > INIT_LIST_HEAD_RCU(&pernet->local_addr_list); > - __reset_counters(pernet); > pernet->next_id = 1; > bitmap_zero(pernet->id_bitmap, MAX_ADDR_ID + 1); > spin_lock_init(&pernet->lock); LGTM. I guess we could drop also bitmap_zero() and add a comment that all fields are already initialized to 0 at allocation time. Thanks! Paolo
Hi Jianguo, Thank you for the patch! On 22/04/2021 11:20, Paolo Abeni wrote: > On Thu, 2021-04-22 at 15:03 +0800, Jianguo Wu wrote: >> From: Jianguo Wu <wujianguo@chinatelecom.cn> >> >> Memory of struct pm_nl_pernet{} is allocated by kzalloc() >> in setup_net()->ops_init(), so it's no need to reset counters >> in pm_nl_init_net(). >> >> Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn> >> --- >> net/mptcp/pm_netlink.c | 1 - >> 1 file changed, 1 deletion(-) >> >> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c >> index 6ba0408..99bb9be 100644 >> --- a/net/mptcp/pm_netlink.c >> +++ b/net/mptcp/pm_netlink.c >> @@ -1913,7 +1913,6 @@ static int __net_init pm_nl_init_net(struct net *net) >> struct pm_nl_pernet *pernet = net_generic(net, pm_nl_pernet_id); >> >> INIT_LIST_HEAD_RCU(&pernet->local_addr_list); >> - __reset_counters(pernet); >> pernet->next_id = 1; >> bitmap_zero(pernet->id_bitmap, MAX_ADDR_ID + 1); >> spin_lock_init(&pernet->lock); > > LGTM. > > I guess we could drop also bitmap_zero() and add a comment that all > fields are already initialized to 0 at allocation time. If you don't mind, please send a v2 including these two other modifications Cheers, Matt
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 6ba0408..99bb9be 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1913,7 +1913,6 @@ static int __net_init pm_nl_init_net(struct net *net) struct pm_nl_pernet *pernet = net_generic(net, pm_nl_pernet_id); INIT_LIST_HEAD_RCU(&pernet->local_addr_list); - __reset_counters(pernet); pernet->next_id = 1; bitmap_zero(pernet->id_bitmap, MAX_ADDR_ID + 1); spin_lock_init(&pernet->lock);