Skip to content

Commit

Permalink
can: gw: switch cangw_pernet_exit() to batch mode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and Jakub Kicinski committed Feb 9, 2022
1 parent 696e595 commit ef0de66
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions net/can/gw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ef0de66

Please sign in to comment.