Subject: Re: [PATCH 2.6.24 1/1] sch_htb: fix "too many events" situation

From: Martin Devera <[email-masked]>
Date: Mon, 18 Feb 2008 11:08:09 +0100

David Miller wrote:
> From: Martin Devera <[email-masked]>
> Date: Mon, 18 Feb 2008 09:03:52 +0100
> 
>> aha, ok, I'm not so informed about crossplatform issues.
>> I was also thining about looking at jiffies value and stop once
>> it is startjiffy+2, but with NO_HZ introduction, are jiffies
>> still incremented ?
> 
> There should always be at least once cpu tasked with incrementing
> jiffies.  Lots of stuff would break if not :-)
> 

Aha ok, so that when (at least one) cpu is busy then I can count on
jiffies incrementing via do_timer, can't I ?
So that I'd remove the loop limit altogether but limiting it to
1 or 2 jiffies to prevent livelock.
Like
max_jiff = jiffies+2; /* not +1 at we could be at +0.9999 now */
while (jiffies<max_jiff) do_hard_potentionaly_long_work();
if (more_work) schedule_to_next_jiffie();

This will keep event queue work load under 66% of system load which
seems reasonable to me.

Would you accept such solution ?