summaryrefslogtreecommitdiffstats
path: root/net/can/gw.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2022-02-08 05:50:36 +0100
committerJakub Kicinski <kuba@kernel.org>2022-02-09 05:41:35 +0100
commitef0de6696c38cbefba64fc1e29c18882bac1f747 (patch)
tree7e3d083d9d8e0b0f2fd554a2d8213ec9a74136d8 /net/can/gw.c
parentipmr: introduce ipmr_net_exit_batch() (diff)
downloadlinux-ef0de6696c38cbefba64fc1e29c18882bac1f747.tar.xz
linux-ef0de6696c38cbefba64fc1e29c18882bac1f747.zip
can: gw: switch cangw_pernet_exit() to batch mode
cleanup_net() is competing with other rtnl users. Avoiding to acquire rtnl for each netns before calling cgw_remove_all_jobs() gives chance for cleanup_net() to progress much faster, holding rtnl a bit longer. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/can/gw.c')
-rw-r--r--net/can/gw.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/can/gw.c b/net/can/gw.c
index d8861e862f15..24221352e059 100644
--- a/net/can/gw.c
+++ b/net/can/gw.c
@@ -1239,16 +1239,19 @@ static int __net_init cangw_pernet_init(struct net *net)
return 0;
}
-static void __net_exit cangw_pernet_exit(struct net *net)
+static void __net_exit cangw_pernet_exit_batch(struct list_head *net_list)
{
+ struct net *net;
+
rtnl_lock();
- cgw_remove_all_jobs(net);
+ list_for_each_entry(net, net_list, exit_list)
+ cgw_remove_all_jobs(net);
rtnl_unlock();
}
static struct pernet_operations cangw_pernet_ops = {
.init = cangw_pernet_init,
- .exit = cangw_pernet_exit,
+ .exit_batch = cangw_pernet_exit_batch,
};
static __init int cgw_module_init(void)