diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-10-27 03:07:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-28 05:22:09 -0400 |
commit | eef6dd65e331d6e91a39b90344c705bbcbe0825e (patch) | |
tree | 6dd95aa32b9b57020a66e99380a4323b5a28d511 /net/ipv4/ip_gre.c | |
parent | 0694c4c016df34c718b9f9ef6ba5aca2e178163a (diff) |
gre: 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/ipv4/ip_gre.c')
-rw-r--r-- | net/ipv4/ip_gre.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 40f043915235..a77807d449e3 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -1290,16 +1290,19 @@ static const struct net_protocol ipgre_protocol = { | |||
1290 | .netns_ok = 1, | 1290 | .netns_ok = 1, |
1291 | }; | 1291 | }; |
1292 | 1292 | ||
1293 | static void ipgre_destroy_tunnels(struct ipgre_net *ign) | 1293 | static void ipgre_destroy_tunnels(struct ipgre_net *ign, struct list_head *head) |
1294 | { | 1294 | { |
1295 | int prio; | 1295 | int prio; |
1296 | 1296 | ||
1297 | for (prio = 0; prio < 4; prio++) { | 1297 | for (prio = 0; prio < 4; prio++) { |
1298 | int h; | 1298 | int h; |
1299 | for (h = 0; h < HASH_SIZE; h++) { | 1299 | for (h = 0; h < HASH_SIZE; h++) { |
1300 | struct ip_tunnel *t; | 1300 | struct ip_tunnel *t = ign->tunnels[prio][h]; |
1301 | while ((t = ign->tunnels[prio][h]) != NULL) | 1301 | |
1302 | unregister_netdevice(t->dev); | 1302 | while (t != NULL) { |
1303 | unregister_netdevice_queue(t->dev, head); | ||
1304 | t = t->next; | ||
1305 | } | ||
1303 | } | 1306 | } |
1304 | } | 1307 | } |
1305 | } | 1308 | } |
@@ -1347,10 +1350,12 @@ err_alloc: | |||
1347 | static void ipgre_exit_net(struct net *net) | 1350 | static void ipgre_exit_net(struct net *net) |
1348 | { | 1351 | { |
1349 | struct ipgre_net *ign; | 1352 | struct ipgre_net *ign; |
1353 | LIST_HEAD(list); | ||
1350 | 1354 | ||
1351 | ign = net_generic(net, ipgre_net_id); | 1355 | ign = net_generic(net, ipgre_net_id); |
1352 | rtnl_lock(); | 1356 | rtnl_lock(); |
1353 | ipgre_destroy_tunnels(ign); | 1357 | ipgre_destroy_tunnels(ign, &list); |
1358 | unregister_netdevice_many(&list); | ||
1354 | rtnl_unlock(); | 1359 | rtnl_unlock(); |
1355 | kfree(ign); | 1360 | kfree(ign); |
1356 | } | 1361 | } |