All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Changli Gao <xiaosuo@gmail.com>
Cc: Jamal Hadi Salim <hadi@cyberus.ca>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Martin Devera <martin.devera@cdi.cz>
Subject: Re: [PATCH] sch_htb: ix the deficit overflows
Date: Tue, 01 Dec 2009 20:12:20 +0100	[thread overview]
Message-ID: <4B156A94.9030409@gmail.com> (raw)
In-Reply-To: <20091201084332.GB6408@ff.dom.local>

Jarek Poplawski wrote, On 12/01/2009 09:43 AM:

> And, again, there are less invasive ways to fix such overflow, like
> 
> htb_dequeue_tree()
> {
> ...
>         if (likely(skb != NULL)) {
>                 cl->un.leaf.deficit[level] -= qdisc_pkt_len(skb);
>                 if (cl->un.leaf.deficit[level] < 0) {
>                         cl->un.leaf.deficit[level] += cl->quantum;
> 
> +                	if (cl->un.leaf.deficit[level] < 0)
> +                        	cl->un.leaf.deficit[level] = -cl->quantum;
> +				/* or other limit */
> 
>                         htb_next_rb_node((level ? cl->parent->un.inner.ptr : q->
>                                           ptr[0]) + prio);
>                 }
>                 /* this used to be after charge_class but this constelation
>                    gives us slightly better performance */
>                 if (!cl->un.leaf.q->q.qlen)
>                         htb_deactivate(q, cl);
>                 htb_charge_class(q, cl, level, skb);
>         }
>         return skb;
> }
> 
> or even always zeroing cl->un.leaf.deficit[level] on activation or
> deactivation (it's seems unlikely one activity period is enough for
> such an overflow).

So, as I wrote before, your proposal based on the first variant is
acceptable to me, but please reconsider the second idea too, e.g.
done like this:

                 }
                 /* this used to be after charge_class but this constelation
                    gives us slightly better performance */
                 if (!cl->un.leaf.q->q.qlen) {
                         htb_deactivate(q, cl);
+			 if (unlikely(cl->un.leaf.deficit[level] < cl->quantum)) {
+				{ a warning }
+                      	 	cl->un.leaf.deficit[level] = 0;
+			 }
 		 }
                 htb_charge_class(q, cl, level, skb);
         }
         return skb;
 }

Jarek P.

  parent reply	other threads:[~2009-12-01 19:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-27  8:14 [PATCH] sch_htb: ix the deficit overflows Changli Gao
2009-11-28  0:04 ` Jarek Poplawski
2009-11-30  4:26   ` Changli Gao
2009-11-30 11:10     ` Jarek Poplawski
2009-12-01  2:32       ` Changli Gao
2009-12-01  8:01         ` Jarek Poplawski
2009-12-01  8:43           ` Jarek Poplawski
2009-12-01  9:18             ` Changli Gao
2009-12-01  9:39               ` Jarek Poplawski
2009-12-01 19:12             ` Jarek Poplawski [this message]
2009-12-01 19:18               ` Jarek Poplawski
2009-12-02  9:20       ` David Miller
2009-12-02 10:32         ` Jarek Poplawski
2009-12-02 11:07           ` Martin Devera

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=4B156A94.9030409@gmail.com \
    --to=jarkao2@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hadi@cyberus.ca \
    --cc=martin.devera@cdi.cz \
    --cc=netdev@vger.kernel.org \
    --cc=xiaosuo@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.