* [PATCH 2.6.24 ver2 1/1] sch_htb: fix "too many events" situation
@ 2008-03-09 13:52 Martin Devera
2008-03-24 5:01 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Martin Devera @ 2008-03-09 13:52 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Martin Devera <devik@cdi.cz>
HTB is event driven algorithm and part of its work is to apply
scheduled events at proper times. It tried to defend itself from
livelock by processing only limited number of events per dequeue.
Because of faster computers some users already hit this hardcoded
limit.
This patch limits processing up to 2 jiffies (why not 1 jiffie ?
because it might stop prematurely when only fraction of jiffie
remains).
Signed-off-by: Martin Devera <devik@cdi.cz>
--- a/net/sched/sch_htb.c 2008-02-14 22:56:48.000000000 +0100
+++ b/net/sched/sch_htb.c 2008-03-09 14:43:30.000000000 +0100
@@ -708,9 +708,11 @@
*/
static psched_time_t htb_do_events(struct htb_sched *q, int level)
{
- int i;
-
- for (i = 0; i < 500; i++) {
+ /* don't run for longer than 2 jiffies; 2 is used instead of
+ 1 to simplify things when jiffy is going to be incremented
+ too soon */
+ unsigned long stop_at = jiffies + 2;
+ while (time_before(jiffies, stop_at)) {
struct htb_class *cl;
long diff;
struct rb_node *p = rb_first(&q->wait_pq[level]);
@@ -728,9 +730,8 @@
if (cl->cmode != HTB_CAN_SEND)
htb_add_to_wait_tree(q, cl, diff);
}
- if (net_ratelimit())
- printk(KERN_WARNING "htb: too many events !\n");
- return q->now + PSCHED_TICKS_PER_SEC / 10;
+ /* too much load - let's continue on next jiffie */
+ return q->now + PSCHED_TICKS_PER_SEC / HZ;
}
/* Returns class->node+prio from id-tree where classe's id is >= id. NULL
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2.6.24 ver2 1/1] sch_htb: fix "too many events" situation
2008-03-09 13:52 [PATCH 2.6.24 ver2 1/1] sch_htb: fix "too many events" situation Martin Devera
@ 2008-03-24 5:01 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-03-24 5:01 UTC (permalink / raw)
To: devik; +Cc: netdev
From: Martin Devera <devik@cdi.cz>
Date: Sun, 09 Mar 2008 14:52:53 +0100
> HTB is event driven algorithm and part of its work is to apply
> scheduled events at proper times. It tried to defend itself from
> livelock by processing only limited number of events per dequeue.
> Because of faster computers some users already hit this hardcoded
> limit.
> This patch limits processing up to 2 jiffies (why not 1 jiffie ?
> because it might stop prematurely when only fraction of jiffie
> remains).
>
> Signed-off-by: Martin Devera <devik@cdi.cz>
Applied, and I'll queue this up for -stable too.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-24 5:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-09 13:52 [PATCH 2.6.24 ver2 1/1] sch_htb: fix "too many events" situation Martin Devera
2008-03-24 5:01 ` David Miller
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).