Commit ac524481 authored by Haishuang Yan's avatar Haishuang Yan Committed by Simon Horman

ipvs: batch __ip_vs_dev_cleanup

It's better to batch __ip_vs_cleanup to speedup ipvs
devices dismantle.
Signed-off-by: default avatarHaishuang Yan <yanhaishuang@cmss.chinamobile.com>
Acked-by: default avatarJulian Anastasov <ja@ssi.bg>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
parent 5d5a0815
...@@ -2433,14 +2433,19 @@ static int __net_init __ip_vs_dev_init(struct net *net) ...@@ -2433,14 +2433,19 @@ static int __net_init __ip_vs_dev_init(struct net *net)
return ret; return ret;
} }
static void __net_exit __ip_vs_dev_cleanup(struct net *net) static void __net_exit __ip_vs_dev_cleanup_batch(struct list_head *net_list)
{ {
struct netns_ipvs *ipvs = net_ipvs(net); struct netns_ipvs *ipvs;
struct net *net;
EnterFunction(2); EnterFunction(2);
nf_unregister_net_hooks(net, ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); list_for_each_entry(net, net_list, exit_list) {
ipvs->enable = 0; /* Disable packet reception */ ipvs = net_ipvs(net);
smp_wmb(); nf_unregister_net_hooks(net, ip_vs_ops, ARRAY_SIZE(ip_vs_ops));
ip_vs_sync_net_cleanup(ipvs); ipvs->enable = 0; /* Disable packet reception */
smp_wmb();
ip_vs_sync_net_cleanup(ipvs);
}
LeaveFunction(2); LeaveFunction(2);
} }
...@@ -2453,7 +2458,7 @@ static struct pernet_operations ipvs_core_ops = { ...@@ -2453,7 +2458,7 @@ static struct pernet_operations ipvs_core_ops = {
static struct pernet_operations ipvs_core_dev_ops = { static struct pernet_operations ipvs_core_dev_ops = {
.init = __ip_vs_dev_init, .init = __ip_vs_dev_init,
.exit = __ip_vs_dev_cleanup, .exit_batch = __ip_vs_dev_cleanup_batch,
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment