Re: bad networking related lag in v2.6.22-rc2

From: Patrick McHardy
Date: Mon May 21 2007 - 17:30:47 EST


Patrick McHardy wrote:
> Ingo Molnar wrote:
>
>>* Anant Nitya <kernel@xxxxxxxxxxxxxx> wrote:
>>
>>>I am posting links to the information you asked for. One more thing,
>>>after digging a bit more I found its QoS shaping that is making the
>>>box crawl. Once I disabled the traffic shaping everything comes back
>>>to smooth and normal. Shaping being done on very low speed residential
>>>ADSL 256/64 Kbps connection. If you want me to post shaping rules,
>>>please free to ask. BTW its a simple HTB/SFQ rules.
>>
>>[...]
>>
>>
>>>http://cybertek.info/taitai/trace-to-ingo.txt.bz2
>>
>>
>>thanks! This trace indeed includes the smoking gun, htb_dequeue() and
>>__qdisc_run():
>>
>>[..]
>
> This looks like fallout from the switch to hrtimers. Anant, please
> send me your HTB script, I'll try to reproduce it.


I think I already found the bug, please try if this patch helps.

[NET_SCHED]: sch_htb: fix event cache time calculation

The event cache time must be an absolute value, when no event exists it is
incorrectly set to 1s instead of 1s in the future.

Should fix excessive load reported by Anant Nitya <kernel@xxxxxxxxxxxxxx>.

Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>

---
commit 49d1023ea0ea8377e740123d5954e88a00f78b7c
tree 031c210f1b5e37ade5a4fa519f5808cd49225b89
parent 637fc540b0ad22bf7971929e906e704236af06cd
author Patrick McHardy <kaber@xxxxxxxxx> Mon, 21 May 2007 23:24:16 +0200
committer Patrick McHardy <kaber@xxxxxxxxx> Mon, 21 May 2007 23:25:51 +0200

net/sched/sch_htb.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 99bcec8..035788c 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -976,8 +976,9 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch)

if (q->now >= q->near_ev_cache[level]) {
event = htb_do_events(q, level);
- q->near_ev_cache[level] = event ? event :
- PSCHED_TICKS_PER_SEC;
+ if (!event)
+ event = q->now + PSCHED_TICKS_PER_SEC;
+ q->near_ev_cache[level] = event;
} else
event = q->near_ev_cache[level];