Cong Wang
e4b95c41df
net_sched: introduce tcf_exts_get_net() and tcf_exts_put_net()
...
Instead of holding netns refcnt in tc actions, we can minimize
the holding time by saving it in struct tcf_exts instead. This
means we can just hold netns refcnt right before call_rcu() and
release it after tcf_exts_destroy() is done.
However, because on netns cleanup path we call tcf_proto_destroy()
too, obviously we can not hold netns for a zero refcnt, in this
case we have to do cleanup synchronously. It is fine for RCU too,
the caller cleanup_net() already waits for a grace period.
For other cases, refcnt is non-zero and we can safely grab it as
normal and release it after we are done.
This patch provides two new API for each filter to use:
tcf_exts_get_net() and tcf_exts_put_net(). And all filters now can
use the following pattern:
void __destroy_filter() {
tcf_exts_destroy();
tcf_exts_put_net(); // <== release netns refcnt
kfree();
}
void some_work() {
rtnl_lock();
__destroy_filter();
rtnl_unlock();
}
void some_rcu_callback() {
tcf_queue_work(some_work);
}
if (tcf_exts_get_net()) // <== hold netns refcnt
call_rcu(some_rcu_callback);
else
__destroy_filter();
Cc: Lucas Bates <lucasb@mojatatu.com >
Cc: Jamal Hadi Salim <jhs@mojatatu.com >
Cc: Jiri Pirko <jiri@resnulli.us >
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com >
Signed-off-by: David S. Miller <davem@davemloft.net >
2017-11-09 10:03:09 +09:00
..
2017-07-11 06:08:58 -04:00
2017-09-01 22:49:47 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-04-05 10:15:20 +02:00
2017-10-29 18:03:24 +09:00
2017-11-02 11:10:55 +01:00
2017-04-12 22:02:36 +02:00
2017-11-09 10:03:09 +09:00
2017-11-02 11:10:55 +01:00
2017-08-29 10:55:20 +01:00
2017-11-02 11:10:55 +01:00
2017-04-24 12:35:56 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-05-27 18:51:41 -04:00
2017-08-11 14:21:42 -07:00
2017-08-11 14:59:24 -07:00
2017-07-04 22:35:16 +01:00
2017-06-13 11:04:37 +02:00
2016-07-08 12:20:57 +02:00
2017-01-20 12:12:13 -05:00
2017-07-04 01:29:04 -07:00
2016-04-19 20:09:25 -04:00
2016-04-25 16:44:27 -04:00
2016-06-25 12:19:35 -04:00
2016-04-25 16:44:27 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-08-31 14:42:19 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-09-05 11:53:34 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-08-22 14:29:30 -07:00
2017-11-02 11:10:55 +01:00
2017-09-01 20:33:42 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-10-18 09:40:35 +02:00
2016-09-30 13:29:21 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2016-04-27 22:48:25 -04:00
2017-01-25 16:00:33 +01:00
2017-07-04 01:29:04 -07:00
2017-11-02 11:10:55 +01:00
2017-01-18 13:04:28 -05:00
2017-08-07 11:39:22 -07:00
2017-11-02 11:10:55 +01:00
2017-06-15 12:12:40 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-08-07 11:39:21 -07:00
2017-10-26 17:41:32 +09:00
2016-12-29 11:38:31 -05:00
2017-11-02 11:10:55 +01:00
2016-03-13 23:55:13 -04:00
2017-09-01 17:42:05 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-08-03 15:35:59 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-08-21 17:06:42 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-07-04 01:29:03 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2016-08-17 19:36:23 -04:00
2016-10-13 12:05:26 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-07-04 22:35:15 +01:00
2017-11-02 11:10:55 +01:00
2017-09-05 11:28:43 +02:00
2016-07-08 13:23:12 +02:00
2017-11-02 11:10:55 +01:00
2017-04-01 20:21:44 -07:00
2016-10-03 02:00:22 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-07-01 07:39:09 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2016-07-08 12:20:57 +02:00
2017-08-29 15:16:52 -07:00
2017-11-02 11:10:55 +01:00
2016-03-23 22:09:58 -04:00
2017-11-09 10:03:09 +09:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-10-01 03:55:47 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-08-07 11:39:21 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-07-01 07:39:08 -07:00
2017-11-02 11:10:55 +01:00
2017-10-01 03:55:47 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 10:04:46 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2016-11-09 20:40:06 -05:00
2017-08-25 17:10:23 -07:00
2017-11-02 11:10:55 +01:00
2016-04-28 11:49:45 -04:00
2017-11-02 11:10:55 +01:00
2017-09-21 20:42:15 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-10-25 10:37:11 +09:00
2017-08-07 14:48:48 -07:00
2017-11-01 21:18:34 +09:00
2017-06-15 12:12:40 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-08-29 15:16:52 -07:00
2017-11-02 11:10:55 +01:00
2017-10-01 03:55:47 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00