netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: xiyou.wangcong@gmail.com, davem@davemloft.net, jhs@mojatatu.com,
	netdev@vger.kernel.org, paulmck@linux.vnet.ibm.com,
	brouer@redhat.com
Subject: Re: [net-next PATCH v4 12/16] net: sched: rcu'ify cls_bpf
Date: Fri, 12 Sep 2014 08:16:04 -0700	[thread overview]
Message-ID: <54130E34.3050001@gmail.com> (raw)
In-Reply-To: <1410402481.7106.51.camel@edumazet-glaptop2.roam.corp.google.com>

On 09/10/2014 07:28 PM, Eric Dumazet wrote:
> On Wed, 2014-09-10 at 08:51 -0700, John Fastabend wrote:
>> This patch makes the cls_bpf classifier RCU safe. The tcf_lock
>> was being used to protect a list of cls_bpf_prog now this list
>> is RCU safe and updates occur with rcu_replace.
>>
>> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
>
> ...

[...]

>> @@ -281,15 +280,17 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,
>>   	if (ret < 0)
>>   		goto errout;
>>
>> -	tcf_tree_lock(tp);
>> -	list_add(&prog->link, &head->plist);
>> -	tcf_tree_unlock(tp);
>> +	if (oldprog) {
>> +		list_replace_rcu(&prog->link, &oldprog->link);
>> +		call_rcu(&oldprog->rcu, __cls_bpf_delete_prog);
>> +	} else {
>> +		list_add_rcu(&prog->link, &head->plist);
>> +	}
>>
>>   	*arg = (unsigned long) prog;
>> -
>>   	return 0;
>>   errout:
>> -	if (*arg == 0UL && prog)
>> +	if (prog)
>>   		kfree(prog);
>>
>
> nit, you can directly call kfree(prog) even if prog == NULL
>

Yep, made the change.

-- 
John Fastabend         Intel Corporation

  reply	other threads:[~2014-09-12 15:16 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10 15:46 [net-next PATCH v4 00/16] net/sched use rcu filters John Fastabend
2014-09-10 15:47 ` [net-next PATCH v4 01/16] net: qdisc: use rcu prefix and silence sparse warnings John Fastabend
2014-09-11  0:23   ` Eric Dumazet
2014-09-10 15:47 ` [net-next PATCH v4 02/16] net: rcu-ify tcf_proto John Fastabend
2014-09-11  0:56   ` Eric Dumazet
2014-09-12 15:03     ` John Fastabend
2014-09-10 15:47 ` [net-next PATCH v4 03/16] net: sched: cls_basic use RCU John Fastabend
2014-09-10 15:48 ` [net-next PATCH v4 04/16] net: sched: cls_cgroup " John Fastabend
2014-09-10 15:48 ` [net-next PATCH v4 05/16] net: sched: cls_flow " John Fastabend
2014-09-11  0:58   ` Eric Dumazet
2014-09-10 15:49 ` [net-next PATCH v4 06/16] net: sched: fw " John Fastabend
2014-09-11  1:03   ` Eric Dumazet
2014-09-10 15:49 ` [net-next PATCH v4 07/16] net: sched: RCU cls_route John Fastabend
2014-09-11  1:12   ` Eric Dumazet
2014-09-10 15:50 ` [net-next PATCH v4 08/16] net: sched: RCU cls_tcindex John Fastabend
2014-09-11  1:17   ` Eric Dumazet
2014-09-10 15:50 ` [net-next PATCH v4 09/16] net: sched: make cls_u32 per cpu John Fastabend
2014-09-11  1:19   ` Eric Dumazet
2014-09-10 15:50 ` [net-next PATCH v4 10/16] net: sched: make cls_u32 lockless John Fastabend
2014-09-11  1:26   ` Eric Dumazet
2014-09-10 15:51 ` [net-next PATCH v4 11/16] net: sched: rcu'ify cls_rsvp John Fastabend
2014-09-11  1:30   ` Eric Dumazet
2014-09-12 15:13     ` John Fastabend
2014-09-10 15:51 ` [net-next PATCH v4 12/16] net: sched: rcu'ify cls_bpf John Fastabend
2014-09-11  2:28   ` Eric Dumazet
2014-09-12 15:16     ` John Fastabend [this message]
2014-09-10 15:52 ` [net-next PATCH v4 13/16] net: sched: make tc_action safe to walk under RCU John Fastabend
2014-09-10 15:52 ` [net-next PATCH v4 14/16] net: sched: make bstats per cpu and estimator RCU safe John Fastabend
2014-09-10 15:52 ` [net-next PATCH v4 15/16] net: sched: make qstats per cpu John Fastabend
2014-09-10 15:53 ` [net-next PATCH v4 16/16] net: sched: drop ingress qdisc lock John Fastabend

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=54130E34.3050001@gmail.com \
    --to=john.fastabend@gmail.com \
    --cc=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --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 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).