ip6tnl: Optimize multiple unregistration

Speedup module unloading by factorizing synchronize_rcu() calls

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Eric Dumazet 2009-10-28 05:16:51 +00:00 committed by David S. Miller
parent 8c56ba0530
commit cf4432f550

View file

@ -1393,14 +1393,19 @@ static void ip6_tnl_destroy_tunnels(struct ip6_tnl_net *ip6n)
{ {
int h; int h;
struct ip6_tnl *t; struct ip6_tnl *t;
LIST_HEAD(list);
for (h = 0; h < HASH_SIZE; h++) { for (h = 0; h < HASH_SIZE; h++) {
while ((t = ip6n->tnls_r_l[h]) != NULL) t = ip6n->tnls_r_l[h];
unregister_netdevice(t->dev); while (t != NULL) {
unregister_netdevice_queue(t->dev, &list);
t = t->next;
}
} }
t = ip6n->tnls_wc[0]; t = ip6n->tnls_wc[0];
unregister_netdevice(t->dev); unregister_netdevice_queue(t->dev, &list);
unregister_netdevice_many(&list);
} }
static int ip6_tnl_init_net(struct net *net) static int ip6_tnl_init_net(struct net *net)