diff options
author | Eric Dumazet <edumazet@google.com> | 2017-09-19 16:27:08 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-09-19 16:32:23 -0700 |
commit | bb401caefe9d2c65e0c0fa23b21deecfbfa473fe (patch) | |
tree | 265825e512645729790e0f932b82c9b09ff7fa08 /net/ipv6/ip6_gre.c | |
parent | 789e6ddb0b2fb5d5024b760b178a47876e4de7a6 (diff) | |
download | linux-bb401caefe9d2c65e0c0fa23b21deecfbfa473fe.tar.gz linux-bb401caefe9d2c65e0c0fa23b21deecfbfa473fe.tar.bz2 linux-bb401caefe9d2c65e0c0fa23b21deecfbfa473fe.zip |
ipv6: speedup ipv6 tunnels dismantle
Implement exit_batch() method to dismantle more devices
per round.
(rtnl_lock() ...
unregister_netdevice_many() ...
rtnl_unlock())
Tested:
$ cat add_del_unshare.sh
for i in `seq 1 40`
do
(for j in `seq 1 100` ; do unshare -n /bin/true >/dev/null ; done) &
done
wait ; grep net_namespace /proc/slabinfo
Before patch :
$ time ./add_del_unshare.sh
net_namespace 110 267 5504 1 2 : tunables 8 4 0 : slabdata 110 267 0
real 3m25.292s
user 0m0.644s
sys 0m40.153s
After patch:
$ time ./add_del_unshare.sh
net_namespace 126 282 5504 1 2 : tunables 8 4 0 : slabdata 126 282 0
real 1m38.965s
user 0m0.688s
sys 0m37.017s
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_gre.c')
-rw-r--r-- | net/ipv6/ip6_gre.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index b7a72d409334..c82d41ef25e2 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -1155,19 +1155,21 @@ err_alloc_dev: return err; } -static void __net_exit ip6gre_exit_net(struct net *net) +static void __net_exit ip6gre_exit_batch_net(struct list_head *net_list) { + struct net *net; LIST_HEAD(list); rtnl_lock(); - ip6gre_destroy_tunnels(net, &list); + list_for_each_entry(net, net_list, exit_list) + ip6gre_destroy_tunnels(net, &list); unregister_netdevice_many(&list); rtnl_unlock(); } static struct pernet_operations ip6gre_net_ops = { .init = ip6gre_init_net, - .exit = ip6gre_exit_net, + .exit_batch = ip6gre_exit_batch_net, .id = &ip6gre_net_id, .size = sizeof(struct ip6gre_net), }; |