Commit 039af9c6 authored by Cong Wang's avatar Cong Wang Committed by David S. Miller

net_sched: switch to exit_batch for action pernet ops

Since we now hold RTNL lock in tc_action_net_exit(), it is good to
batch them to speedup tc action dismantle.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cdc0974f
...@@ -120,12 +120,19 @@ int tc_action_net_init(struct tc_action_net *tn, ...@@ -120,12 +120,19 @@ int tc_action_net_init(struct tc_action_net *tn,
void tcf_idrinfo_destroy(const struct tc_action_ops *ops, void tcf_idrinfo_destroy(const struct tc_action_ops *ops,
struct tcf_idrinfo *idrinfo); struct tcf_idrinfo *idrinfo);
static inline void tc_action_net_exit(struct tc_action_net *tn) static inline void tc_action_net_exit(struct list_head *net_list,
unsigned int id)
{ {
struct net *net;
rtnl_lock(); rtnl_lock();
tcf_idrinfo_destroy(tn->ops, tn->idrinfo); list_for_each_entry(net, net_list, exit_list) {
struct tc_action_net *tn = net_generic(net, id);
tcf_idrinfo_destroy(tn->ops, tn->idrinfo);
kfree(tn->idrinfo);
}
rtnl_unlock(); rtnl_unlock();
kfree(tn->idrinfo);
} }
int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb, int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,
......
...@@ -401,16 +401,14 @@ static __net_init int bpf_init_net(struct net *net) ...@@ -401,16 +401,14 @@ static __net_init int bpf_init_net(struct net *net)
return tc_action_net_init(tn, &act_bpf_ops); return tc_action_net_init(tn, &act_bpf_ops);
} }
static void __net_exit bpf_exit_net(struct net *net) static void __net_exit bpf_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, bpf_net_id); tc_action_net_exit(net_list, bpf_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations bpf_net_ops = { static struct pernet_operations bpf_net_ops = {
.init = bpf_init_net, .init = bpf_init_net,
.exit = bpf_exit_net, .exit_batch = bpf_exit_net,
.id = &bpf_net_id, .id = &bpf_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -209,16 +209,14 @@ static __net_init int connmark_init_net(struct net *net) ...@@ -209,16 +209,14 @@ static __net_init int connmark_init_net(struct net *net)
return tc_action_net_init(tn, &act_connmark_ops); return tc_action_net_init(tn, &act_connmark_ops);
} }
static void __net_exit connmark_exit_net(struct net *net) static void __net_exit connmark_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, connmark_net_id); tc_action_net_exit(net_list, connmark_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations connmark_net_ops = { static struct pernet_operations connmark_net_ops = {
.init = connmark_init_net, .init = connmark_init_net,
.exit = connmark_exit_net, .exit_batch = connmark_exit_net,
.id = &connmark_net_id, .id = &connmark_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -635,16 +635,14 @@ static __net_init int csum_init_net(struct net *net) ...@@ -635,16 +635,14 @@ static __net_init int csum_init_net(struct net *net)
return tc_action_net_init(tn, &act_csum_ops); return tc_action_net_init(tn, &act_csum_ops);
} }
static void __net_exit csum_exit_net(struct net *net) static void __net_exit csum_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, csum_net_id); tc_action_net_exit(net_list, csum_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations csum_net_ops = { static struct pernet_operations csum_net_ops = {
.init = csum_init_net, .init = csum_init_net,
.exit = csum_exit_net, .exit_batch = csum_exit_net,
.id = &csum_net_id, .id = &csum_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -235,16 +235,14 @@ static __net_init int gact_init_net(struct net *net) ...@@ -235,16 +235,14 @@ static __net_init int gact_init_net(struct net *net)
return tc_action_net_init(tn, &act_gact_ops); return tc_action_net_init(tn, &act_gact_ops);
} }
static void __net_exit gact_exit_net(struct net *net) static void __net_exit gact_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, gact_net_id); tc_action_net_exit(net_list, gact_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations gact_net_ops = { static struct pernet_operations gact_net_ops = {
.init = gact_init_net, .init = gact_init_net,
.exit = gact_exit_net, .exit_batch = gact_exit_net,
.id = &gact_net_id, .id = &gact_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -858,16 +858,14 @@ static __net_init int ife_init_net(struct net *net) ...@@ -858,16 +858,14 @@ static __net_init int ife_init_net(struct net *net)
return tc_action_net_init(tn, &act_ife_ops); return tc_action_net_init(tn, &act_ife_ops);
} }
static void __net_exit ife_exit_net(struct net *net) static void __net_exit ife_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, ife_net_id); tc_action_net_exit(net_list, ife_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations ife_net_ops = { static struct pernet_operations ife_net_ops = {
.init = ife_init_net, .init = ife_init_net,
.exit = ife_exit_net, .exit_batch = ife_exit_net,
.id = &ife_net_id, .id = &ife_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -337,16 +337,14 @@ static __net_init int ipt_init_net(struct net *net) ...@@ -337,16 +337,14 @@ static __net_init int ipt_init_net(struct net *net)
return tc_action_net_init(tn, &act_ipt_ops); return tc_action_net_init(tn, &act_ipt_ops);
} }
static void __net_exit ipt_exit_net(struct net *net) static void __net_exit ipt_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, ipt_net_id); tc_action_net_exit(net_list, ipt_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations ipt_net_ops = { static struct pernet_operations ipt_net_ops = {
.init = ipt_init_net, .init = ipt_init_net,
.exit = ipt_exit_net, .exit_batch = ipt_exit_net,
.id = &ipt_net_id, .id = &ipt_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
...@@ -387,16 +385,14 @@ static __net_init int xt_init_net(struct net *net) ...@@ -387,16 +385,14 @@ static __net_init int xt_init_net(struct net *net)
return tc_action_net_init(tn, &act_xt_ops); return tc_action_net_init(tn, &act_xt_ops);
} }
static void __net_exit xt_exit_net(struct net *net) static void __net_exit xt_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, xt_net_id); tc_action_net_exit(net_list, xt_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations xt_net_ops = { static struct pernet_operations xt_net_ops = {
.init = xt_init_net, .init = xt_init_net,
.exit = xt_exit_net, .exit_batch = xt_exit_net,
.id = &xt_net_id, .id = &xt_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -334,16 +334,14 @@ static __net_init int mirred_init_net(struct net *net) ...@@ -334,16 +334,14 @@ static __net_init int mirred_init_net(struct net *net)
return tc_action_net_init(tn, &act_mirred_ops); return tc_action_net_init(tn, &act_mirred_ops);
} }
static void __net_exit mirred_exit_net(struct net *net) static void __net_exit mirred_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, mirred_net_id); tc_action_net_exit(net_list, mirred_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations mirred_net_ops = { static struct pernet_operations mirred_net_ops = {
.init = mirred_init_net, .init = mirred_init_net,
.exit = mirred_exit_net, .exit_batch = mirred_exit_net,
.id = &mirred_net_id, .id = &mirred_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -310,16 +310,14 @@ static __net_init int nat_init_net(struct net *net) ...@@ -310,16 +310,14 @@ static __net_init int nat_init_net(struct net *net)
return tc_action_net_init(tn, &act_nat_ops); return tc_action_net_init(tn, &act_nat_ops);
} }
static void __net_exit nat_exit_net(struct net *net) static void __net_exit nat_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, nat_net_id); tc_action_net_exit(net_list, nat_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations nat_net_ops = { static struct pernet_operations nat_net_ops = {
.init = nat_init_net, .init = nat_init_net,
.exit = nat_exit_net, .exit_batch = nat_exit_net,
.id = &nat_net_id, .id = &nat_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -453,16 +453,14 @@ static __net_init int pedit_init_net(struct net *net) ...@@ -453,16 +453,14 @@ static __net_init int pedit_init_net(struct net *net)
return tc_action_net_init(tn, &act_pedit_ops); return tc_action_net_init(tn, &act_pedit_ops);
} }
static void __net_exit pedit_exit_net(struct net *net) static void __net_exit pedit_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, pedit_net_id); tc_action_net_exit(net_list, pedit_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations pedit_net_ops = { static struct pernet_operations pedit_net_ops = {
.init = pedit_init_net, .init = pedit_init_net,
.exit = pedit_exit_net, .exit_batch = pedit_exit_net,
.id = &pedit_net_id, .id = &pedit_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -334,16 +334,14 @@ static __net_init int police_init_net(struct net *net) ...@@ -334,16 +334,14 @@ static __net_init int police_init_net(struct net *net)
return tc_action_net_init(tn, &act_police_ops); return tc_action_net_init(tn, &act_police_ops);
} }
static void __net_exit police_exit_net(struct net *net) static void __net_exit police_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, police_net_id); tc_action_net_exit(net_list, police_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations police_net_ops = { static struct pernet_operations police_net_ops = {
.init = police_init_net, .init = police_init_net,
.exit = police_exit_net, .exit_batch = police_exit_net,
.id = &police_net_id, .id = &police_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -236,16 +236,14 @@ static __net_init int sample_init_net(struct net *net) ...@@ -236,16 +236,14 @@ static __net_init int sample_init_net(struct net *net)
return tc_action_net_init(tn, &act_sample_ops); return tc_action_net_init(tn, &act_sample_ops);
} }
static void __net_exit sample_exit_net(struct net *net) static void __net_exit sample_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, sample_net_id); tc_action_net_exit(net_list, sample_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations sample_net_ops = { static struct pernet_operations sample_net_ops = {
.init = sample_init_net, .init = sample_init_net,
.exit = sample_exit_net, .exit_batch = sample_exit_net,
.id = &sample_net_id, .id = &sample_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -204,16 +204,14 @@ static __net_init int simp_init_net(struct net *net) ...@@ -204,16 +204,14 @@ static __net_init int simp_init_net(struct net *net)
return tc_action_net_init(tn, &act_simp_ops); return tc_action_net_init(tn, &act_simp_ops);
} }
static void __net_exit simp_exit_net(struct net *net) static void __net_exit simp_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, simp_net_id); tc_action_net_exit(net_list, simp_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations simp_net_ops = { static struct pernet_operations simp_net_ops = {
.init = simp_init_net, .init = simp_init_net,
.exit = simp_exit_net, .exit_batch = simp_exit_net,
.id = &simp_net_id, .id = &simp_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -241,16 +241,14 @@ static __net_init int skbedit_init_net(struct net *net) ...@@ -241,16 +241,14 @@ static __net_init int skbedit_init_net(struct net *net)
return tc_action_net_init(tn, &act_skbedit_ops); return tc_action_net_init(tn, &act_skbedit_ops);
} }
static void __net_exit skbedit_exit_net(struct net *net) static void __net_exit skbedit_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, skbedit_net_id); tc_action_net_exit(net_list, skbedit_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations skbedit_net_ops = { static struct pernet_operations skbedit_net_ops = {
.init = skbedit_init_net, .init = skbedit_init_net,
.exit = skbedit_exit_net, .exit_batch = skbedit_exit_net,
.id = &skbedit_net_id, .id = &skbedit_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -266,16 +266,14 @@ static __net_init int skbmod_init_net(struct net *net) ...@@ -266,16 +266,14 @@ static __net_init int skbmod_init_net(struct net *net)
return tc_action_net_init(tn, &act_skbmod_ops); return tc_action_net_init(tn, &act_skbmod_ops);
} }
static void __net_exit skbmod_exit_net(struct net *net) static void __net_exit skbmod_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, skbmod_net_id); tc_action_net_exit(net_list, skbmod_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations skbmod_net_ops = { static struct pernet_operations skbmod_net_ops = {
.init = skbmod_init_net, .init = skbmod_init_net,
.exit = skbmod_exit_net, .exit_batch = skbmod_exit_net,
.id = &skbmod_net_id, .id = &skbmod_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -325,16 +325,14 @@ static __net_init int tunnel_key_init_net(struct net *net) ...@@ -325,16 +325,14 @@ static __net_init int tunnel_key_init_net(struct net *net)
return tc_action_net_init(tn, &act_tunnel_key_ops); return tc_action_net_init(tn, &act_tunnel_key_ops);
} }
static void __net_exit tunnel_key_exit_net(struct net *net) static void __net_exit tunnel_key_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, tunnel_key_net_id); tc_action_net_exit(net_list, tunnel_key_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations tunnel_key_net_ops = { static struct pernet_operations tunnel_key_net_ops = {
.init = tunnel_key_init_net, .init = tunnel_key_init_net,
.exit = tunnel_key_exit_net, .exit_batch = tunnel_key_exit_net,
.id = &tunnel_key_net_id, .id = &tunnel_key_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
...@@ -301,16 +301,14 @@ static __net_init int vlan_init_net(struct net *net) ...@@ -301,16 +301,14 @@ static __net_init int vlan_init_net(struct net *net)
return tc_action_net_init(tn, &act_vlan_ops); return tc_action_net_init(tn, &act_vlan_ops);
} }
static void __net_exit vlan_exit_net(struct net *net) static void __net_exit vlan_exit_net(struct list_head *net_list)
{ {
struct tc_action_net *tn = net_generic(net, vlan_net_id); tc_action_net_exit(net_list, vlan_net_id);
tc_action_net_exit(tn);
} }
static struct pernet_operations vlan_net_ops = { static struct pernet_operations vlan_net_ops = {
.init = vlan_init_net, .init = vlan_init_net,
.exit = vlan_exit_net, .exit_batch = vlan_exit_net,
.id = &vlan_net_id, .id = &vlan_net_id,
.size = sizeof(struct tc_action_net), .size = sizeof(struct tc_action_net),
}; };
......
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