netdev.vger.kernel.org archive mirror
 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, 1 Dec 2009 09:39:23 +0000	[thread overview]
Message-ID: <20091201093923.GA7573@ff.dom.local> (raw)
In-Reply-To: <412e6f7f0912010118l19b3a759n925138fbc6dd6f56@mail.gmail.com>

On Tue, Dec 01, 2009 at 05:18:32PM +0800, Changli Gao wrote:
> On Tue, Dec 1, 2009 at 4:43 PM, Jarek Poplawski <jarkao2@gmail.com> wrote:
> > On Tue, Dec 01, 2009 at 08:01:51AM +0000, Jarek Poplawski wrote:
> >> On Tue, Dec 01, 2009 at 10:32:26AM +0800, Changli Gao wrote:
> >> > On Mon, Nov 30, 2009 at 7:10 PM, Jarek Poplawski <jarkao2@gmail.com> wrote:
> > ...
> >> > > And this patch is very similar, except ->peek()/dequeue(). Additional
> >> > > lookups are done instead of dequeuing the first found class, which
> >> > > might be quite long in some cases.
> >> >
> >> > If the quantum is set correctly, there isn't difference except of a
> >> > comparison. In the other case, I think some additional CPU cycles are
> >> > better than overflow.
> >>
> >> No, my main point is there _is_ a difference when the quantum is set
> >> correctly. Just these additional lookups.
> >
> > 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;
> 
> How about this:
>          if (cl->un.leaf.deficit[level] < 0) {
>                 cl->un.leaf.deficit[level] = 0;
>                 if (!(cl->warned & HTB_WARN_QUANTUM_SMALL)) {
>                         printk(KERN_WARNING
>                                "HTB: quantum of class %X is small.
> Consider r2q change.\n",
>                                cl->common.classid);
>                     cl->warned |= HTB_WARN_QUANTUM_SMALL;
>                 }
>          }

I guess you mean q->warned. Maybe unlikely() would be useful too.
Otherwise, it's acceptable to me, especially when you write you really
hit this problem (not theoretical only ;-)

Jarek P.

  reply	other threads:[~2009-12-01  9:39 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 [this message]
2009-12-01 19:12             ` Jarek Poplawski
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=20091201093923.GA7573@ff.dom.local \
    --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 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).