[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260204075347.3508631-1-realwujing@gmail.com>
Date: Wed, 4 Feb 2026 02:53:42 -0500
From: Qiliang Yuan <realwujing@...il.com>
To: kuniyu@...gle.com
Cc: brauner@...nel.org,
davem@...emloft.net,
edumazet@...gle.com,
horms@...nel.org,
jack@...e.cz,
jlayton@...nel.org,
kuba@...nel.org,
linux-kernel@...r.kernel.org,
netdev@...r.kernel.org,
pabeni@...hat.com,
realwujing@...il.com,
sd@...asysnail.net,
yuanql9@...natelecom.cn
Subject: Re: [PATCH v5] netns: optimize netns cleaning by batching unhash_nsid calls
Hi Kuniyuki,
Thanks for your review and suggestions!
On Tue, 3 Feb 2026 16:20:18 -0800 Kuniyuki Iwashima <kuniyu@...gle.com> wrote:
> batch and system is a bit unclear, maybe M_dying_net,
> N_alive_net or something ?
Good point. I've updated the terminology in the commit message to
M_dying_net and N_alive_net for better clarity.
> Also, isn't __peernet2id() also O(N_ids) ?
Yes, you are right. __peernet2id() performs a linear search in the IDR,
so it is indeed O(N_id). I've corrected the complexity analysis in the
commit log. This actually makes the batching optimization even more
valuable.
> Please put this in a hole, maybe after after hash_mix :
>
> $ pahole -C net vmlinux
Updated. I've moved the 'is_dying' flag to the hole after 'hash_mix'
to avoid increasing the size of struct net.
> No need to move id up.
Fixed. I've scoped the 'id' variable locally within the traversal loop
to keep it cleaner.
> This can be done unconditionally as the id will never
> be assigned to dying nets.
>
> while (...) {
> id++;
>
> if (!net->dying)
> continue;
>
> /* do cleanup */
> }
Simplified as suggested. The loop logic is much cleaner now with the
unconditional increment.
I've sent out v6 with these changes.
v6 link: https://lore.kernel.org/all/20260204074854.3506916-1-realwujing@gmail.com/
Best regards,
Qiliang
Powered by blists - more mailing lists