]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
netns: add schedule point in ops_exit_list()
authorEric Dumazet <edumazet@google.com>
Tue, 18 Jan 2022 11:43:40 +0000 (03:43 -0800)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 7 Mar 2022 15:36:57 +0000 (16:36 +0100)
commit9a08096ad5a6b00df05a54eac839694de14d0cb4
treea4af56d443caccf4d3a412d89ad8b985740fff12
parent5e51a835cf90f21c2bd173da53636128c52334ef
netns: add schedule point in ops_exit_list()

BugLink: https://bugs.launchpad.net/bugs/1960566
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/core/net_namespace.c