* [Patch net v2] act_sample: get rid of tcf_sample_cleanup_rcu()
@ 2017-11-30 0:07 Cong Wang
2017-11-30 3:11 ` Eric Dumazet
2017-11-30 15:19 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Cong Wang @ 2017-11-30 0:07 UTC (permalink / raw)
To: netdev; +Cc: eric.dumazet, Cong Wang, Jamal Hadi Salim, Jiri Pirko, Yotam Gigi
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.
Fixes: 5c5670fae430 ("net/sched: Introduce sample tc action")
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
include/net/tc_act/tc_sample.h | 1 -
net/sched/act_sample.c | 14 +++-----------
2 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/include/net/tc_act/tc_sample.h b/include/net/tc_act/tc_sample.h
index 524cee4f4c81..01dbfea32672 100644
--- a/include/net/tc_act/tc_sample.h
+++ b/include/net/tc_act/tc_sample.h
@@ -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)
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index 8b5abcd2f32f..9438969290a6 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -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);
}
--
2.13.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Patch net v2] act_sample: get rid of tcf_sample_cleanup_rcu()
2017-11-30 0:07 [Patch net v2] act_sample: get rid of tcf_sample_cleanup_rcu() Cong Wang
@ 2017-11-30 3:11 ` Eric Dumazet
2017-11-30 15:19 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2017-11-30 3:11 UTC (permalink / raw)
To: Cong Wang, netdev; +Cc: Jamal Hadi Salim, Jiri Pirko, Yotam Gigi
On Wed, 2017-11-29 at 16:07 -0800, Cong Wang wrote:
> 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.
>
> Fixes: 5c5670fae430 ("net/sched: Introduce sample tc action")
> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Cc: Jiri Pirko <jiri@resnulli.us>
> Cc: Yotam Gigi <yotamg@mellanox.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
> include/net/tc_act/tc_sample.h | 1 -
> net/sched/act_sample.c | 14 +++-----------
> 2 files changed, 3 insertions(+), 12 deletions(-)
>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Thanks !
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch net v2] act_sample: get rid of tcf_sample_cleanup_rcu()
2017-11-30 0:07 [Patch net v2] act_sample: get rid of tcf_sample_cleanup_rcu() Cong Wang
2017-11-30 3:11 ` Eric Dumazet
@ 2017-11-30 15:19 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-11-30 15:19 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, eric.dumazet, jhs, jiri, yotamg
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Wed, 29 Nov 2017 16:07:51 -0800
> 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.
>
> Fixes: 5c5670fae430 ("net/sched: Introduce sample tc action")
> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Cc: Jiri Pirko <jiri@resnulli.us>
> Cc: Yotam Gigi <yotamg@mellanox.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-30 15:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-30 0:07 [Patch net v2] act_sample: get rid of tcf_sample_cleanup_rcu() Cong Wang
2017-11-30 3:11 ` Eric Dumazet
2017-11-30 15:19 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).