Skip to content

Commit 422b5ae

Browse files
Eric Dumazetkuba-moo
authored andcommitted
bareudp: use exit_batch_rtnl() method
exit_batch_rtnl() is called while RTNL is held, and devices to be unregistered can be queued in the dev_kill_list. This saves one rtnl_lock()/rtnl_unlock() pair, and one unregister_netdevice_many() call. Signed-off-by: Eric Dumazet <[email protected]> Reviewed-by: Antoine Tenart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a7ec251 commit 422b5ae

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

drivers/net/bareudp.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -760,23 +760,18 @@ static void bareudp_destroy_tunnels(struct net *net, struct list_head *head)
760760
unregister_netdevice_queue(bareudp->dev, head);
761761
}
762762

763-
static void __net_exit bareudp_exit_batch_net(struct list_head *net_list)
763+
static void __net_exit bareudp_exit_batch_rtnl(struct list_head *net_list,
764+
struct list_head *dev_kill_list)
764765
{
765766
struct net *net;
766-
LIST_HEAD(list);
767767

768-
rtnl_lock();
769768
list_for_each_entry(net, net_list, exit_list)
770-
bareudp_destroy_tunnels(net, &list);
771-
772-
/* unregister the devices gathered above */
773-
unregister_netdevice_many(&list);
774-
rtnl_unlock();
769+
bareudp_destroy_tunnels(net, dev_kill_list);
775770
}
776771

777772
static struct pernet_operations bareudp_net_ops = {
778773
.init = bareudp_init_net,
779-
.exit_batch = bareudp_exit_batch_net,
774+
.exit_batch_rtnl = bareudp_exit_batch_rtnl,
780775
.id = &bareudp_net_id,
781776
.size = sizeof(struct bareudp_net),
782777
};

0 commit comments

Comments
 (0)