ip6tnl: Optimize multiple unregistration
authorEric Dumazet <eric.dumazet@gmail.com>
Wed, 28 Oct 2009 05:16:51 +0000 (05:16 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 29 Oct 2009 08:13:48 +0000 (01:13 -0700)
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>
net/ipv6/ip6_tunnel.c

index 670c291d25675f601a185cf11392915cfa126355..6c1b5c98e818d0e20424584c088e55adc3ae9daa 100644 (file)
@@ -1393,14 +1393,19 @@ static void ip6_tnl_destroy_tunnels(struct ip6_tnl_net *ip6n)
 {
        int h;
        struct ip6_tnl *t;
+       LIST_HEAD(list);
 
        for (h = 0; h < HASH_SIZE; h++) {
-               while ((t = ip6n->tnls_r_l[h]) != NULL)
-                       unregister_netdevice(t->dev);
+               t = ip6n->tnls_r_l[h];
+               while (t != NULL) {
+                       unregister_netdevice_queue(t->dev, &list);
+                       t = t->next;
+               }
        }
 
        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)