From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <johannes@sipsolutions.net>
Cc: <alexandre.ferrieux@gmail.com>, <alexandre.ferrieux@orange.com>,
<edumazet@google.com>, <horms@kernel.org>, <kuniyu@amazon.com>,
<linux-wireless@vger.kernel.org>, <netdev@vger.kernel.org>
Subject: Re: RFC: Should net namespaces scale up (>10k) ?
Date: Tue, 8 Oct 2024 11:56:47 -0700 [thread overview]
Message-ID: <20241008185647.10517-1-kuniyu@amazon.com> (raw)
In-Reply-To: <cd8045c03573a012f71a1afdcfb5d9c108b6fefa.camel@sipsolutions.net>
From: Johannes Berg <johannes@sipsolutions.net>
Date: Tue, 08 Oct 2024 20:22:38 +0200
> On Tue, 2024-10-08 at 10:47 -0700, Kuniyuki Iwashima wrote:
>
> > > 1. The "netdevice notifier" from the Wireless Extensions subsystem
> > > insists on scanning the whole list regardless of the nature of the
> > > change, nor wondering whether all these namespaces hold any wireless
> > > interface, nor even whether the system has _any_ wireless hardware...
> > >
> > > for_each_net(net) {
> > > while ((skb = skb_dequeue(&net->wext_nlevents)))
> > > rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL,
> > > GFP_KERNEL);
> > > }
> > >
> >
> > Alex forwarded this mail to me and asked about 1.
> >
> > I checked 8bf862739a778, but I didn't see why wext_netdev_notifier_call()
> > needs to iterate all netns.
>
> Agree. That code is ancient, and I don't remember why, but I'd think
> it's just because I was lazy then.
>
> > diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
> > index 838ad6541a17..d4b613fc650c 100644
> > --- a/net/wireless/wext-core.c
> > +++ b/net/wireless/wext-core.c
> > @@ -343,17 +343,22 @@ static const int compat_event_type_size[] = {
> >
> > /* IW event code */
> >
> > -void wireless_nlevent_flush(void)
> > +static void wireless_nlevent_flush_net(struct net *net)
> > {
> > struct sk_buff *skb;
> > +
> > + while ((skb = skb_dequeue(&net->wext_nlevents)))
> > + rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL,
> > + GFP_KERNEL);
> > +}
> > +
> > +void wireless_nlevent_flush(void)
> > +{
> > struct net *net;
> >
> > down_read(&net_rwsem);
> > - for_each_net(net) {
> > - while ((skb = skb_dequeue(&net->wext_nlevents)))
> > - rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL,
> > - GFP_KERNEL);
> > - }
> > + for_each_net(net)
> > + wireless_nlevent_flush_net(net);
> > up_read(&net_rwsem);
> > }
> > EXPORT_SYMBOL_GPL(wireless_nlevent_flush);
>
> Note 1: I just posted this patch yesterday:
> https://lore.kernel.org/linux-wireless/20241007214715.3dd736dc3ac0.I1388536e99c37f28a007dd753c473ad21513d9a9@changeid/
>
> so that would conflict here, I'd think.
>
> Note 2: the only other caller to wireless_nlevent_flush() is from
> wireless_nlevent_process()/wireless_nlevent_work, and that work could
> easily be made per netns since it comes along with net->wext_nlevents,
> and then we don't need any global function at all. Seems this could be
> implemented in wext_pernet_init()/wext_pernet_exit() pretty easily?
Sounds good.
I'll post a patch after yours lands on wireless-next.
Thanks!
next prev parent reply other threads:[~2024-10-08 18:56 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-15 20:49 RFC: Should net namespaces scale up (>10k) ? Alexandre Ferrieux
2024-09-16 10:13 ` Przemek Kitszel
2024-09-16 14:01 ` Simon Horman
2024-09-16 22:05 ` Alexandre Ferrieux
2024-09-17 6:40 ` Przemek Kitszel
2024-09-17 11:06 ` Alexandre Ferrieux
2024-09-17 6:59 ` Eric Dumazet
2024-09-17 12:30 ` Nicolas Dichtel
2024-09-24 14:06 ` Massive hash collisions on FIB Alexandre Ferrieux
2024-09-24 14:36 ` Eric Dumazet
2024-09-24 17:18 ` Alexandre Ferrieux
2024-09-25 19:06 ` Alexandre Ferrieux
2024-09-25 19:25 ` Eric Dumazet
2024-09-25 19:46 ` Alexandre Ferrieux
2024-09-25 20:12 ` Eric Dumazet
2024-09-25 21:26 ` Alexandre Ferrieux
2024-09-16 21:36 ` RFC: Should net namespaces scale up (>10k) ? Alexandre Ferrieux
2024-10-08 17:47 ` Kuniyuki Iwashima
2024-10-08 18:22 ` Johannes Berg
2024-10-08 18:56 ` Kuniyuki Iwashima [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-09-14 22:34 alexandre.ferrieux
2024-09-15 18:58 ` Simon Horman
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=20241008185647.10517-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=alexandre.ferrieux@gmail.com \
--cc=alexandre.ferrieux@orange.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).