From: Qiliang Yuan <realwujing@gmail.com>
To: kuniyu@google.com
Cc: brauner@kernel.org, davem@davemloft.net, edumazet@google.com,
horms@kernel.org, jack@suse.cz, jlayton@kernel.org,
kuba@kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, pabeni@redhat.com, realwujing@gmail.com,
sd@queasysnail.net, yuanql9@chinatelecom.cn
Subject: Re: [PATCH v5] netns: optimize netns cleaning by batching unhash_nsid calls
Date: Wed, 4 Feb 2026 02:53:42 -0500 [thread overview]
Message-ID: <20260204075347.3508631-1-realwujing@gmail.com> (raw)
In-Reply-To: <CAAVpQUAcn5kAHE+FniMt-wn1iM3hP9L7L0VhQUzzk130i4X0zw@mail.gmail.com>
Hi Kuniyuki,
Thanks for your review and suggestions!
On Tue, 3 Feb 2026 16:20:18 -0800 Kuniyuki Iwashima <kuniyu@google.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
prev parent reply other threads:[~2026-02-04 7:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-02 2:39 [PATCH v5] netns: optimize netns cleaning by batching unhash_nsid calls Qiliang Yuan
2026-02-04 0:20 ` Kuniyuki Iwashima
2026-02-04 7:53 ` Qiliang Yuan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260204075347.3508631-1-realwujing@gmail.com \
--to=realwujing@gmail.com \
--cc=brauner@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sd@queasysnail.net \
--cc=yuanql9@chinatelecom.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox