diff options
author | Eric Dumazet <edumazet@google.com> | 2022-01-18 03:43:40 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-01-27 11:05:35 +0100 |
commit | 31428796ca4b00cc10fda059ac24eb0be61778d5 (patch) | |
tree | 1f9f7a503442f8bfe5467c260eabc8061c691e48 /net/core | |
parent | 958cbb139ec4a58cc2a9652e72e9c54882da0682 (diff) | |
download | linux-stable-31428796ca4b00cc10fda059ac24eb0be61778d5.tar.gz linux-stable-31428796ca4b00cc10fda059ac24eb0be61778d5.tar.bz2 linux-stable-31428796ca4b00cc10fda059ac24eb0be61778d5.zip |
netns: add schedule point in ops_exit_list()
commit 2836615aa22de55b8fca5e32fe1b27a67cda625e upstream.
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: 72ad937abd0a ("net: Add support for batching network namespace cleanups")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/net_namespace.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 202fa5eacd0f..9702d2b0d920 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -164,8 +164,10 @@ static void ops_exit_list(const struct pernet_operations *ops, { struct net *net; if (ops->exit) { - list_for_each_entry(net, net_exit_list, exit_list) + list_for_each_entry(net, net_exit_list, exit_list) { ops->exit(net); + cond_resched(); + } } if (ops->exit_batch) ops->exit_batch(net_exit_list); |