Skip to content

Commit 2836615

Browse files
edumazetdavem330
authored andcommitted
netns: add schedule point in ops_exit_list()
When under stress, cleanup_net() can have to dismantle netns in big numbers. ops_exit_list() currently calls many helpers [1] that have no schedule point, and we can end up with soft lockups, particularly on hosts with many cpus. Even for moderate amount of netns processed by cleanup_net() this patch avoids latency spikes. [1] Some of these helpers like fib_sync_up() and fib_sync_down_dev() are very slow because net/ipv4/fib_semantics.c uses host-wide hash tables, and ifindex is used as the only input of two hash functions. ifindexes tend to be the same for all netns (lo.ifindex==1 per instance) This will be fixed in a separate patch. Fixes: 72ad937 ("net: Add support for batching network namespace cleanups") Signed-off-by: Eric Dumazet <[email protected]> Cc: Eric W. Biederman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5765cee commit 2836615

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/core/net_namespace.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,10 @@ static void ops_exit_list(const struct pernet_operations *ops,
164164
{
165165
struct net *net;
166166
if (ops->exit) {
167-
list_for_each_entry(net, net_exit_list, exit_list)
167+
list_for_each_entry(net, net_exit_list, exit_list) {
168168
ops->exit(net);
169+
cond_resched();
170+
}
169171
}
170172
if (ops->exit_batch)
171173
ops->exit_batch(net_exit_list);

0 commit comments

Comments
 (0)