[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7896488c10ef95255b3fef157cede5ad77d9a8cd.camel@redhat.com>
Date: Mon, 21 Feb 2022 17:45:11 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v2 net-next] gro_cells: avoid using synchronize_rcu() in
gro_cells_destroy()
On Mon, 2022-02-21 at 06:21 -0800, Eric Dumazet wrote:
> On Mon, Feb 21, 2022 at 12:24 AM Paolo Abeni <pabeni@...hat.com> wrote:
> >
> > Hello,
> >
> > On Sat, 2022-02-19 at 20:11 -0800, Eric Dumazet wrote:
> > > From: Eric Dumazet <edumazet@...gle.com>
> > >
> > > Another thing making netns dismantles potentially very slow is located
> > > in gro_cells_destroy(),
> > > whenever cleanup_net() has to remove a device using gro_cells framework.
> > >
> > > RTNL is not held at this stage, so synchronize_net()
> > > is calling synchronize_rcu():
> > >
> > > netdev_run_todo()
> > > ip_tunnel_dev_free()
> > > gro_cells_destroy()
> > > synchronize_net()
> > > synchronize_rcu() // Ouch.
> > >
> > > This patch uses call_rcu(), and gave me a 25x performance improvement
> > > in my tests.
> > >
> > > cleanup_net() is no longer blocked ~10 ms per synchronize_rcu()
> > > call.
> > >
> > > In the case we could not allocate the memory needed to queue the
> > > deferred free, use synchronize_rcu_expedited()
> > >
> > > v2: made percpu_free_defer_callback() static
> > >
> > > Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> >
> > I'm sorry for the late feedback. I'm wondering if you considered
> > placing the 'defer' pointer inside 'gro_cells' and allocating it at
> > gro_cells_init() init time?
>
> I did consider this, but I chose not to risk changing structure
> layouts and adding regression in fast paths,
> with extra cache line misses.
Understood, thanks!
Acked-by: Paolo Abeni <pabeni@...hat.com>
Powered by blists - more mailing lists