All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mptcp: remove redundant couters reset in pm_nl_init_net()
@ 2021-04-22  7:03 Jianguo Wu
  2021-04-22  9:20 ` Paolo Abeni
  0 siblings, 1 reply; 3+ messages in thread
From: Jianguo Wu @ 2021-04-22  7:03 UTC (permalink / raw)
  To: mptcp; +Cc: Paolo Abeni, Matthieu Baerts, Mat Martineau

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);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mptcp: remove redundant couters reset in pm_nl_init_net()
  2021-04-22  7:03 [PATCH] mptcp: remove redundant couters reset in pm_nl_init_net() Jianguo Wu
@ 2021-04-22  9:20 ` Paolo Abeni
  2021-04-22  9:31   ` Matthieu Baerts
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Abeni @ 2021-04-22  9:20 UTC (permalink / raw)
  To: Jianguo Wu, mptcp; +Cc: Matthieu Baerts, Mat Martineau

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mptcp: remove redundant couters reset in pm_nl_init_net()
  2021-04-22  9:20 ` Paolo Abeni
@ 2021-04-22  9:31   ` Matthieu Baerts
  0 siblings, 0 replies; 3+ messages in thread
From: Matthieu Baerts @ 2021-04-22  9:31 UTC (permalink / raw)
  To: Jianguo Wu; +Cc: Mat Martineau, Paolo Abeni, mptcp

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
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-22  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22  7:03 [PATCH] mptcp: remove redundant couters reset in pm_nl_init_net() Jianguo Wu
2021-04-22  9:20 ` Paolo Abeni
2021-04-22  9:31   ` Matthieu Baerts

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.