act_sample: get rid of tcf_sample_cleanup_rcu()
Subsystems (3)
PATCH v2 1/1 act_sample: get rid of tcf_sample_cleanup_rcu()
Similar to commit d7fb60b9cafb ("net_sched: get rid of tcfa_rcu"), TC actions don't need to respect RCU grace period, because it is either just detached from tc filter (standalone case) or it is removed together with tc filter (bound case) in which case RCU grace period is already respected at filter layer.
--- include/net/tc_act/tc_sample.h | 1 - net/sched/act_sample.c | 14 +++----------- 2 files changed, 3 insertions(+), 12 deletions(-)
include/net/tc_act/tc_sample.h +0 -1
@@ -14,7 +14,6 @@ struct tcf_sample {struct psample_group __rcu *psample_group;u32 psample_group_num;struct list_head tcfm_list; -struct rcu_head rcu; };#define to_sample (a) ((struct tcf_sample *)a)
net/sched/act_sample.c +3 -11
@@ -96,23 +96,16 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,return ret; } -static void tcf_sample_cleanup_rcu (struct rcu_head *rcu) +static void tcf_sample_cleanup (struct tc_action *a,int bind) { - struct tcf_sample *s = container_of(rcu, struct tcf_sample, rcu); +struct tcf_sample *s =to_sample (a);struct psample_group *psample_group; - psample_group =rcu_dereference_protected (s->psample_group,1 ); + psample_group =rtnl_dereference (s->psample_group);RCU_INIT_POINTER (s->psample_group,NULL );psample_group_put (psample_group); } -static void tcf_sample_cleanup (struct tc_action *a,int bind) -{ -struct tcf_sample *s =to_sample (a); - -call_rcu (&s->rcu, tcf_sample_cleanup_rcu); -} -static bool tcf_sample_dev_ok_push (struct net_device *dev) {switch (dev->type) {
@@ -264,7 +257,6 @@ static int __init sample_init_module(void) static void __exit sample_cleanup_module(void) { -rcu_barrier ();tcf_unregister_action (&act_sample_ops, &sample_net_ops); }
Signature · 1 line
2.13.0
Quoted 12 lines · Cong Wang
Similar to commit
d7fb60b9cafb("net_sched: get rid oftcfa_rcu"), TC actions don't need to respect RCU grace period, because it is either just detached from tc filter (standalone case) or it is removed together with tc filter (bound case) in which case RCU grace period is already respected at filter layer.Fixes 5c5670fae430 ("net/sched: Introduce sample tc action")Reported-by Eric Dumazet <[email protected]>Cc Jamal Hadi Salim <[email protected]>Cc Jiri Pirko <[email protected]>Cc Yotam Gigi <[email protected]>Signed-off-by Cong Wang <[email protected]>
Quoted 5 lines
---
include/net/tc_act/tc_sample.h | 1 - net/sched/act_sample.c | 14 +++-----------2 files changed, 3 insertions(+), 12 deletions(-)
Thanks !
From: Cong Wang <[email protected]>
Date: Wed, 29 Nov 2017 16:07:51 -0800
Quoted 6 lines
Similar to commit
d7fb60b9cafb("net_sched: get rid oftcfa_rcu"), TC actions don't need to respect RCU grace period, because it is either just detached from tc filter (standalone case) or it is removed together with tc filter (bound case) in which case RCU grace period is already respected at filter layer.
Quoted 6 lines
Fixes 5c5670fae430 ("net/sched: Introduce sample tc action")Reported-by Eric Dumazet <[email protected]>Cc Jamal Hadi Salim <[email protected]>Cc Jiri Pirko <[email protected]>Cc Yotam Gigi <[email protected]>Signed-off-by Cong Wang <[email protected]>
Applied, thank you.