Skip to content

Commit

Permalink
nexthop: change nexthop_net_exit() to nexthop_net_exit_batch()
Browse files Browse the repository at this point in the history
cleanup_net() is competing with other rtnl users.

nexthop_net_exit() seems a good candidate for exit_batch(),
as this gives chance for cleanup_net() to progress much faster,
holding rtnl a bit longer.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Eric Dumazet authored and Jakub Kicinski committed Feb 9, 2022
1 parent e66d117 commit fea7b20
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions net/ipv4/nexthop.c
Original file line number Diff line number Diff line change
@@ -3733,12 +3733,16 @@ void nexthop_res_grp_activity_update(struct net *net, u32 id, u16 num_buckets,
}
EXPORT_SYMBOL(nexthop_res_grp_activity_update);

static void __net_exit nexthop_net_exit(struct net *net)
static void __net_exit nexthop_net_exit_batch(struct list_head *net_list)
{
struct net *net;

rtnl_lock();
flush_all_nexthops(net);
list_for_each_entry(net, net_list, exit_list) {
flush_all_nexthops(net);
kfree(net->nexthop.devhash);
}
rtnl_unlock();
kfree(net->nexthop.devhash);
}

static int __net_init nexthop_net_init(struct net *net)
@@ -3756,7 +3760,7 @@ static int __net_init nexthop_net_init(struct net *net)

static struct pernet_operations nexthop_net_ops = {
.init = nexthop_net_init,
.exit = nexthop_net_exit,
.exit_batch = nexthop_net_exit_batch,
};

static int __init nexthop_init(void)

0 comments on commit fea7b20

Please sign in to comment.