diff mbox series

[v2,RESEND] mptcp: remove redundant initialization in pm_nl_init_net()

Message ID 2462aa3f-f72b-e31e-7a58-346ddc5ac546@163.com
State Accepted, archived
Commit 7f8536b0200c8680eb494d40eee82568fe369251
Delegated to: Matthieu Baerts
Headers show
Series [v2,RESEND] mptcp: remove redundant initialization in pm_nl_init_net() | expand

Commit Message

Jianguo Wu April 22, 2021, 10:20 a.m. UTC
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
and zero bitmap in pm_nl_init_net().

Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
---
 net/mptcp/pm_netlink.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Matthieu Baerts April 22, 2021, 2:26 p.m. UTC | #1
Hi Jianguo,

On 22/04/2021 12:20, 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
> and zero bitmap in pm_nl_init_net().

Thank you for the new version.

With Paolo, we slightly modified the comment you added to fix one typo
and make it shorter, nothing important.

Just added in the tree with Paolo's ACK:

- 7f8536b0200c: mptcp: remove redundant initialization in pm_nl_init_net()
- Results: b48a833e40ba..bdc5b468c37c

Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20210422T142551
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export/20210422T142551

Cheers,
Matt
diff mbox series

Patch

diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 6ba0408..becc32b 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -1913,10 +1913,12 @@  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);
+
+	/* No need to initialize other flieds of pernet, as all fields
+	 * are already initialized to 0 at allocation time.
+	 */
 	return 0;
 }