From: John Fastabend <john.fastabend@gmail.com>
To: Cong Wang <cwang@twopensource.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
David Miller <davem@davemloft.net>,
Eric Dumazet <eric.dumazet@gmail.com>,
netdev <netdev@vger.kernel.org>,
Jamal Hadi Salim <jhs@mojatatu.com>
Subject: Re: [net-next PATCH 2/2] net: sched: cls_u32 changes to knode must appear atomic to readers
Date: Wed, 17 Sep 2014 17:06:16 -0700 [thread overview]
Message-ID: <541A21F8.3000206@gmail.com> (raw)
In-Reply-To: <CAHA+R7NWzv8+2aUM1uQX8uZkQv-Dp9fYb0SNwmZqk3gKvXVWtw@mail.gmail.com>
On 09/17/2014 02:11 PM, Cong Wang wrote:
> On Wed, Sep 17, 2014 at 12:12 PM, John Fastabend
> <john.fastabend@gmail.com> wrote:
>>
>> -static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n)
>> +static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n, bool pf)
>> {
>> tcf_unbind_filter(tp, &n->res);
>> tcf_exts_destroy(tp, &n->exts);
>> if (n->ht_down)
>> n->ht_down->refcnt--;
>> #ifdef CONFIG_CLS_U32_PERF
>> - free_percpu(n->pf);
>> + if (pf)
>
> Nit: 'free_pf' is a better name than just 'pf'.
>
agreed I'll update it.
>> + free_percpu(n->pf);
>> #endif
>> #ifdef CONFIG_CLS_U32_MARK
>> - free_percpu(n->pcpu_success);
>> + if (pf)
>> + free_percpu(n->pcpu_success);
>> #endif
>> kfree(n);
>> return 0;
>> }
>>
>> +static void u32_delete_key_rcu_pf(struct rcu_head *rcu)
>> +{
>> + struct tc_u_knode *key = container_of(rcu, struct tc_u_knode, rcu);
>> +
>> + u32_destroy_key(key->tp, key, false);
>> +}
>
> I think you need a comment here to explain why you free it partially
> on purpose, it is not that clear, at least I spent some time to figure
> it out when I read your cls_tcindex patch.
>
> Thanks!
>
Sure how about this,
/* u32_delete_key_rcu_pf should be called when free'ing a copied
* version of a tc_u_knode obtained from u32_init_knode(). When
* copies are obtained from u32_init_knode() the statistics are
* shared between the old and new copies to allow readers to
* continue to update the statistics during the copy. To support
* this the u32_delete_key_rcu_pf variant does not free the percpu
* statistics.
*/
--
John Fastabend Intel Corporation
next prev parent reply other threads:[~2014-09-18 0:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-17 19:11 [net-next PATCH 1/2] net: cls_u32: fix missed pcpu_success free_percpu John Fastabend
2014-09-17 19:12 ` [net-next PATCH 2/2] net: sched: cls_u32 changes to knode must appear atomic to readers John Fastabend
2014-09-17 21:11 ` Cong Wang
2014-09-18 0:06 ` John Fastabend [this message]
2014-09-18 16:28 ` Cong Wang
2014-09-18 16:39 ` John Fastabend
2014-09-18 11:38 ` Jamal Hadi Salim
2014-09-20 4:55 ` John Fastabend
2014-09-18 1:17 ` [net-next PATCH 1/2] net: cls_u32: fix missed pcpu_success free_percpu 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=541A21F8.3000206@gmail.com \
--to=john.fastabend@gmail.com \
--cc=cwang@twopensource.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 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).