* [PATCH net] gro_cells: reduce number of synchronize_net() calls
@ 2020-11-24 20:38 Eric Dumazet
2020-11-25 19:31 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2020-11-24 20:38 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski; +Cc: netdev, Eric Dumazet, Eric Dumazet
From: Eric Dumazet <edumazet@google.com>
After cited commit, gro_cells_destroy() became damn slow
on hosts with a lot of cores.
This is because we have one additional synchronize_net() per cpu as
stated in the changelog.
gro_cells_init() is setting NAPI_STATE_NO_BUSY_POLL, and this was enough
to not have one synchronize_net() call per netif_napi_del()
We can factorize all the synchronize_net() to a single one,
right before freeing per-cpu memory.
Fixes: 5198d545dba8 ("net: remove napi_hash_del() from driver-facing API")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/core/gro_cells.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/core/gro_cells.c b/net/core/gro_cells.c
index e095fb871d9120787bfdf62149f4d82e0e3b0a51..6eb2e5ec2c5068e1d798557e55d084b785187a9b 100644
--- a/net/core/gro_cells.c
+++ b/net/core/gro_cells.c
@@ -99,9 +99,14 @@ void gro_cells_destroy(struct gro_cells *gcells)
struct gro_cell *cell = per_cpu_ptr(gcells->cells, i);
napi_disable(&cell->napi);
- netif_napi_del(&cell->napi);
+ __netif_napi_del(&cell->napi);
__skb_queue_purge(&cell->napi_skbs);
}
+ /* This barrier is needed because netpoll could access dev->napi_list
+ * under rcu protection.
+ */
+ synchronize_net();
+
free_percpu(gcells->cells);
gcells->cells = NULL;
}
--
2.29.2.454.gaff20da3a2-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] gro_cells: reduce number of synchronize_net() calls
2020-11-24 20:38 [PATCH net] gro_cells: reduce number of synchronize_net() calls Eric Dumazet
@ 2020-11-25 19:31 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-11-25 19:31 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David S . Miller, netdev, Eric Dumazet
On Tue, 24 Nov 2020 12:38:22 -0800 Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> After cited commit, gro_cells_destroy() became damn slow
> on hosts with a lot of cores.
>
> This is because we have one additional synchronize_net() per cpu as
> stated in the changelog.
>
> gro_cells_init() is setting NAPI_STATE_NO_BUSY_POLL, and this was enough
> to not have one synchronize_net() call per netif_napi_del()
>
> We can factorize all the synchronize_net() to a single one,
> right before freeing per-cpu memory.
>
> Fixes: 5198d545dba8 ("net: remove napi_hash_del() from driver-facing API")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thank you!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-25 19:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-24 20:38 [PATCH net] gro_cells: reduce number of synchronize_net() calls Eric Dumazet
2020-11-25 19:31 ` Jakub Kicinski
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).