[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54130E34.3050001@gmail.com>
Date: Fri, 12 Sep 2014 08:16:04 -0700
From: John Fastabend <john.fastabend@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
CC: xiyou.wangcong@...il.com, davem@...emloft.net, jhs@...atatu.com,
netdev@...r.kernel.org, paulmck@...ux.vnet.ibm.com,
brouer@...hat.com
Subject: Re: [net-next PATCH v4 12/16] net: sched: rcu'ify cls_bpf
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@...el.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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists