Messages in this thread |  | | Date | Tue, 3 Sep 2002 12:13:34 +0200 (CEST) | From | Tobias Ringstrom <> | Subject | Re: Problem with the O(1) scheduler in 2.4.19 |
| |
On Tue, 3 Sep 2002, Ingo Molnar wrote:
> On Mon, 2 Sep 2002, Tobias Ringstrom wrote: > > > But I still do not understand why the process is classified as > > non-interactive... Around 20 times per second it does a nanosleep for 1 > > ms which takes around 40 ms in reality. (Seeing this makes me believe > > that I should try to increase HZ, but that is a separate issue.) > > what CPU usage does it have? 70% CPU usage is not interactive. > > well, even 70% CPU usage can be interactive if you lower its priority to > -20. But with the default nice value a task will lose its interactivity > much quicker.
If I understand the code in sched.c correctly, the dynamic prio [-5...5] is calculated using sleep_avg, but the name is deceiving, it's more like the edge of a knife. If a process is sleeping, its sleep_avg is incremented by one per timer tick, and if it is running it is decremented by one per timer tick. This means (for a periodic task) that if it sleeps for less than 50% of the timer ticks, it will get a sleep_avg of zero (dynamic prio +5), and if it is sleeping for more than 50%, it will get a sleep_avg of MAX_SLEEP_AVG (dynamic prio -5).
For the case of a game server, this means that when the CPU utilization gets above 50% (roughly), it will switch from -5 to +5 in dynamic priority in a few seconds and stay there until the CPU utilization drops under 50%.
Is my analysis correct, and is this what we want?
Have you experimented with other averaging algorithms?
> also, could you increase HZ to 1000 (in asm/param.h, full recompile of the > kernel is needed), does it make a difference?
I tried that yesterday (without the O(1) scheduler), and it does wonders for the in-game latency (i.e. ping). I suppose that the dynamic prio will still be +5 at 70% CPU utilization even with a HZ of 1000 using the O(1) scheduler. Why would it make a difference?
/Tobias
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |