netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	Alex Gartrell <agartrell@fb.com>,
	David Miller <davem@davemloft.net>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	kernel-team@fb.com, stable@vger.kernel.org
Subject: Re: [PATCH,v2 net] net: sched: validate that class is found in qdisc_tree_decrease_qlen
Date: Tue, 21 Jul 2015 11:12:12 -0700	[thread overview]
Message-ID: <CAM_iQpWWzMFLuLsJZD4rJLW7rNWNOEotrjj7o4Z+0Pr330M2Fw@mail.gmail.com> (raw)
In-Reply-To: <1437475945.9913.7.camel@edumazet-glaptop2.roam.corp.google.com>

On Tue, Jul 21, 2015 at 3:52 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Tue, 2015-07-21 at 06:04 -0400, Jamal Hadi Salim wrote:
>
>> It is worrisome to fix the core code for this. The root cause seems to
>> be codel. Dont have time but in general, reset would be something like:
>>
>> struct fq_codel_sched_data *q = qdisc_priv(sch);
>> qdisc_reset(q)
>
> This only works for very simple qdisc with one queue.
>
>>
>> or something along those lines...
>> But certainly dequeue semantics dont seem right there..
>
> Well, reset() is trivial to implement like this
>
> while (skb = local_dequeue(sch)) {
>         kfree_skb(skb);
> }
>
> And I guess I copy/pasted sfq code here, because I was lazy.
>
> But yes, qdisc_tree_decrease_qlen() would have to be not called.


Hmm, so the semantic is each qdisc resets qlen for its own
and calls qdisc_reset() to reset its leaf qdisc's, that makes sense
for me.

>
> It seems I coded fq_reset() differently.
>
> Alex, please try instead :
>
> diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
> index 21ca33c9f036..3f0320ab6029 100644
> --- a/net/sched/sch_fq_codel.c
> +++ b/net/sched/sch_fq_codel.c
> @@ -288,10 +288,21 @@ begin:
>
>  static void fq_codel_reset(struct Qdisc *sch)
>  {
> -       struct sk_buff *skb;
> +       struct fq_codel_sched_data *q = qdisc_priv(sch);
> +       int i;
>
> -       while ((skb = fq_codel_dequeue(sch)) != NULL)
> -               kfree_skb(skb);
> +       INIT_LIST_HEAD(&q->new_flows);
> +       INIT_LIST_HEAD(&q->old_flows);
> +       for (i = 0; i < q->flows_cnt; i++) {
> +               struct fq_codel_flow *flow = q->flows + i;
> +
> +               while (flow->head)
> +                       kfree_skb(dequeue_head(flow));
> +
> +               INIT_LIST_HEAD(&flow->flowchain);


You probably need to call codel_vars_init(&flow->cvars) as well.

> +       }
> +       memset(q->backlogs, 0, q->flows_cnt * sizeof(u32));
> +       sch->q.qlen = 0;
>  }
>
>  static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = {
>
>
>

Thanks.

  reply	other threads:[~2015-07-21 18:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-20 19:40 [PATCH,v2 net] net: sched: validate that class is found in qdisc_tree_decrease_qlen Alex Gartrell
2015-07-21 10:04 ` Jamal Hadi Salim
2015-07-21 10:52   ` Eric Dumazet
2015-07-21 18:12     ` Cong Wang [this message]
2015-07-21 20:57       ` Eric Dumazet
2015-07-22  2:03         ` Cong Wang
2015-07-22  4:41           ` Eric Dumazet

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=CAM_iQpWWzMFLuLsJZD4rJLW7rNWNOEotrjj7o4Z+0Pr330M2Fw@mail.gmail.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=agartrell@fb.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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).