aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-10-27 03:06:59 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-28 05:22:08 -0400
commit0694c4c016df34c718b9f9ef6ba5aca2e178163a (patch)
tree3f35a7f623114d8435cbdae049ecdbe7abe714d1 /net
parent63c8099d90096db56ee1c66c31f05d4fcfbc1c69 (diff)
ipip: 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>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ipip.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 3bd69988bccf..a2ca53da4372 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -754,16 +754,19 @@ static struct xfrm_tunnel ipip_handler = {
754static const char banner[] __initconst = 754static const char banner[] __initconst =
755 KERN_INFO "IPv4 over IPv4 tunneling driver\n"; 755 KERN_INFO "IPv4 over IPv4 tunneling driver\n";
756 756
757static void ipip_destroy_tunnels(struct ipip_net *ipn) 757static void ipip_destroy_tunnels(struct ipip_net *ipn, struct list_head *head)
758{ 758{
759 int prio; 759 int prio;
760 760
761 for (prio = 1; prio < 4; prio++) { 761 for (prio = 1; prio < 4; prio++) {
762 int h; 762 int h;
763 for (h = 0; h < HASH_SIZE; h++) { 763 for (h = 0; h < HASH_SIZE; h++) {
764 struct ip_tunnel *t; 764 struct ip_tunnel *t = ipn->tunnels[prio][h];
765 while ((t = ipn->tunnels[prio][h]) != NULL) 765
766 unregister_netdevice(t->dev); 766 while (t != NULL) {
767 unregister_netdevice_queue(t->dev, head);
768 t = t->next;
769 }
767 } 770 }
768 } 771 }
769} 772}
@@ -816,11 +819,13 @@ err_alloc:
816static void ipip_exit_net(struct net *net) 819static void ipip_exit_net(struct net *net)
817{ 820{
818 struct ipip_net *ipn; 821 struct ipip_net *ipn;
822 LIST_HEAD(list);
819 823
820 ipn = net_generic(net, ipip_net_id); 824 ipn = net_generic(net, ipip_net_id);
821 rtnl_lock(); 825 rtnl_lock();
822 ipip_destroy_tunnels(ipn); 826 ipip_destroy_tunnels(ipn, &list);
823 unregister_netdevice(ipn->fb_tunnel_dev); 827 unregister_netdevice_queue(ipn->fb_tunnel_dev, &list);
828 unregister_netdevice_many(&list);
824 rtnl_unlock(); 829 rtnl_unlock();
825 kfree(ipn); 830 kfree(ipn);
826} 831}