[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJhf+-myjz0GgTeWmohnoBottRa+nP8DPqM3yoS64cmHQ@mail.gmail.com>
Date: Mon, 7 Feb 2022 09:54:17 -0800
From: Eric Dumazet <edumazet@...gle.com>
To: Oliver Hartkopp <socketcan@...tkopp.net>
Cc: Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev <netdev@...r.kernel.org>,
David Ahern <dsahern@...nel.org>,
Marc Kleine-Budde <mkl@...gutronix.de>
Subject: Re: [PATCH net-next 09/11] can: gw: switch cangw_pernet_exit() to
batch mode
On Mon, Feb 7, 2022 at 9:41 AM Oliver Hartkopp <socketcan@...tkopp.net> wrote:
>
>
>
> On 07.02.22 18:17, Eric Dumazet wrote:
> > From: Eric Dumazet <edumazet@...gle.com>
> >
> > cleanup_net() is competing with other rtnl users.
> >
> > Avoiding to acquire rtnl for each netns before calling
> > cgw_remove_all_jobs() gives chance for cleanup_net()
> > to progress much faster, holding rtnl a bit longer.
> >
> > Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> > Cc: Oliver Hartkopp <socketcan@...tkopp.net>
> > Cc: Marc Kleine-Budde <mkl@...gutronix.de>
> > ---
> > net/can/gw.c | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/net/can/gw.c b/net/can/gw.c
> > index d8861e862f157aec36c417b71eb7e8f59bd064b9..24221352e059be9fb9aca3819be6a7ac4cdef144 100644
> > --- a/net/can/gw.c
> > +++ b/net/can/gw.c
> > @@ -1239,16 +1239,19 @@ static int __net_init cangw_pernet_init(struct net *net)
> > return 0;
> > }
> >
> > -static void __net_exit cangw_pernet_exit(struct net *net)
> > +static void __net_exit cangw_pernet_exit_batch(struct list_head *net_list)
> > {
> > + struct net *net;
> > +
> > rtnl_lock();
> > - cgw_remove_all_jobs(net);
> > + list_for_each_entry(net, net_list, exit_list)
> > + cgw_remove_all_jobs(net);
>
> Instead of removing the jobs for ONE net namespace it seems you are
> remove removing the jobs for ALL net namespaces?
>
> Looks wrong to me.
I see nothing wrong in my patch.
I think you have to look more closely at ops_exit_list() in
net/core/net_namespace.c
BTW, the sychronize_rcu() call in cgw_remove_all_jobs is definitely
bad, you should absolutely replace it by call_rcu() or kfree_rcu()
>
> Best regards,
> Oliver
>
>
> > rtnl_unlock();
> > }
> >
> > static struct pernet_operations cangw_pernet_ops = {
> > .init = cangw_pernet_init,
> > - .exit = cangw_pernet_exit,
> > + .exit_batch = cangw_pernet_exit_batch,
> > };
> >
> > static __init int cgw_module_init(void)
Powered by blists - more mailing lists