Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -120,13 +120,20 @@ int tc_action_net_init(struct tc_action_net *tn,
void tcf_idrinfo_destroy(const struct tc_action_ops *ops,
			 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();
	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);
	rtnl_unlock();
		kfree(tn->idrinfo);
	}
	rtnl_unlock();
}

int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,
		       struct netlink_callback *cb, int type,
+3 −5
Original line number Diff line number Diff line
@@ -401,16 +401,14 @@ static __net_init int bpf_init_net(struct net *net)
	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(tn);
	tc_action_net_exit(net_list, bpf_net_id);
}

static struct pernet_operations bpf_net_ops = {
	.init = bpf_init_net,
	.exit = bpf_exit_net,
	.exit_batch = bpf_exit_net,
	.id   = &bpf_net_id,
	.size = sizeof(struct tc_action_net),
};
+3 −5
Original line number Diff line number Diff line
@@ -209,16 +209,14 @@ static __net_init int connmark_init_net(struct net *net)
	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(tn);
	tc_action_net_exit(net_list, connmark_net_id);
}

static struct pernet_operations connmark_net_ops = {
	.init = connmark_init_net,
	.exit = connmark_exit_net,
	.exit_batch = connmark_exit_net,
	.id   = &connmark_net_id,
	.size = sizeof(struct tc_action_net),
};
+3 −5
Original line number Diff line number Diff line
@@ -635,16 +635,14 @@ static __net_init int csum_init_net(struct net *net)
	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(tn);
	tc_action_net_exit(net_list, csum_net_id);
}

static struct pernet_operations csum_net_ops = {
	.init = csum_init_net,
	.exit = csum_exit_net,
	.exit_batch = csum_exit_net,
	.id   = &csum_net_id,
	.size = sizeof(struct tc_action_net),
};
+3 −5
Original line number Diff line number Diff line
@@ -235,16 +235,14 @@ static __net_init int gact_init_net(struct net *net)
	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(tn);
	tc_action_net_exit(net_list, gact_net_id);
}

static struct pernet_operations gact_net_ops = {
	.init = gact_init_net,
	.exit = gact_exit_net,
	.exit_batch = gact_exit_net,
	.id   = &gact_net_id,
	.size = sizeof(struct tc_action_net),
};
Loading