Skip to content

Commit 2543a60

Browse files
edumazetkuba-moo
authored andcommitted
gro_cells: reduce number of synchronize_net() calls
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: 5198d54 ("net: remove napi_hash_del() from driver-facing API") Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/20201124203822.1360107-1-eric.dumazet@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 12a8fe5 commit 2543a60

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

net/core/gro_cells.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,14 @@ void gro_cells_destroy(struct gro_cells *gcells)
9999
struct gro_cell *cell = per_cpu_ptr(gcells->cells, i);
100100

101101
napi_disable(&cell->napi);
102-
netif_napi_del(&cell->napi);
102+
__netif_napi_del(&cell->napi);
103103
__skb_queue_purge(&cell->napi_skbs);
104104
}
105+
/* This barrier is needed because netpoll could access dev->napi_list
106+
* under rcu protection.
107+
*/
108+
synchronize_net();
109+
105110
free_percpu(gcells->cells);
106111
gcells->cells = NULL;
107112
}

0 commit comments

Comments
 (0)