[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <412e6f7f0912010118l19b3a759n925138fbc6dd6f56@mail.gmail.com>
Date: Tue, 1 Dec 2009 17:18:32 +0800
From: Changli Gao <xiaosuo@...il.com>
To: Jarek Poplawski <jarkao2@...il.com>
Cc: Jamal Hadi Salim <hadi@...erus.ca>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Martin Devera <martin.devera@....cz>
Subject: Re: [PATCH] sch_htb: ix the deficit overflows
On Tue, Dec 1, 2009 at 4:43 PM, Jarek Poplawski <jarkao2@...il.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@...il.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;
}
}
> + /* 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).
>
I found this from http://luxik.cdi.cz/~devik/qos/htb/manual/theory.htm:
HTB uses "real" DRR as defined in [4]. CBQ in Linux uses one where
the quantum can be lower than MTU - it is more generic but it is also
no longer O(1) complexity. It also means that you have to use right
scale for rate->quantum conversion so that all quantums are larger
than MTU.
To keep it O(1) complexity, HTB requires users use the right scale for
quantum. So my first two patches are in the wrong direction.
--
Regards,
Changli Gao(xiaosuo@...il.com)
--
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