From: John Fastabend <john.fastabend@gmail.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: netdev@vger.kernel.org, Eric Dumazet <eric.dumazet@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jamal Hadi Salim <jhs@mojatatu.com>
Subject: Re: [RFC Patch net-next 3/4] net_sched: use RCU for tc actions traverse
Date: Thu, 09 Jan 2014 20:03:19 -0800 [thread overview]
Message-ID: <52CF7107.4020806@gmail.com> (raw)
In-Reply-To: <1389291593-2494-4-git-send-email-xiyou.wangcong@gmail.com>
On 01/09/2014 10:19 AM, Cong Wang wrote:
> Cc: John Fastabend <john.fastabend@gmail.com>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
> net/sched/act_api.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/net/sched/act_api.c b/net/sched/act_api.c
> index f63e146..e3c655e 100644
> --- a/net/sched/act_api.c
> +++ b/net/sched/act_api.c
> @@ -351,7 +351,7 @@ int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions,
> ret = TC_ACT_OK;
> goto exec_done;
> }
> - list_for_each_entry(a, actions, list) {
> + list_for_each_entry_rcu(a, actions, list) {
> repeat:
> ret = a->ops->act(skb, a, res);
> if (TC_MUNGED & skb->tc_verd) {
> @@ -372,11 +372,13 @@ EXPORT_SYMBOL(tcf_action_exec);
> void tcf_action_destroy(struct list_head *actions, int bind)
> {
> struct tc_action *a, *tmp;
> + LIST_HEAD(list);
> + list_splice_init_rcu(actions, &list, synchronize_rcu);
>
> - list_for_each_entry_safe(a, tmp, actions, list) {
> + list_for_each_entry_safe(a, tmp, &list, list) {
> if (a->ops->cleanup(a, bind) == ACT_P_DELETED)
> module_put(a->ops->owner);
> - list_del(&a->list);
> + list_del_rcu(&a->list);
> kfree(a);
no this wont work you need kfree_rcu or call_rcu or rcu sync.
> }
> }
> @@ -420,7 +422,7 @@ tcf_action_dump(struct sk_buff *skb, struct list_head *actions, int bind, int re
> int err = -EINVAL;
> struct nlattr *nest;
>
> - list_for_each_entry(a, actions, list) {
> + list_for_each_entry_rcu(a, actions, list) {
> nest = nla_nest_start(skb, a->order);
> if (nest == NULL)
> goto nla_put_failure;
> @@ -542,7 +544,7 @@ int tcf_action_init(struct net *net, struct nlattr *nla,
> goto err;
> }
> act->order = i;
> - list_add_tail(&act->list, actions);
> + list_add_tail_rcu(&act->list, actions);
> }
> return 0;
>
>
--
John Fastabend Intel Corporation
next prev parent reply other threads:[~2014-01-10 4:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-09 18:19 [RFC Patch net-next 0/4] net_sched: make ingress filters lockless Cong Wang
2014-01-09 18:19 ` [RFC Patch net-next 1/4] net_sched: switch filter list to list_head Cong Wang
2014-01-10 0:17 ` Eric Dumazet
2014-01-10 0:20 ` Cong Wang
2014-01-10 3:48 ` John Fastabend
2014-01-10 4:10 ` Cong Wang
2014-01-09 18:19 ` [RFC Patch net-next 2/4] net_sched: avoid holding qdisc lock for filters Cong Wang
2014-01-10 3:13 ` John Fastabend
2014-01-09 18:19 ` [RFC Patch net-next 3/4] net_sched: use RCU for tc actions traverse Cong Wang
2014-01-10 4:03 ` John Fastabend [this message]
2014-01-09 18:19 ` [RFC Patch net-next 4/4] net_sched: make ingress qdisc lockless Cong Wang
2014-01-10 0:21 ` Eric Dumazet
2014-01-10 0:30 ` Cong Wang
2014-01-10 0:49 ` Stephen Hemminger
2014-01-10 1:06 ` John Fastabend
2014-01-12 12:30 ` Jamal Hadi Salim
2014-01-10 1:09 ` Cong Wang
2014-01-10 1:11 ` Eric Dumazet
2014-01-10 1:21 ` Cong Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52CF7107.4020806@gmail.com \
--to=john.fastabend@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.