Re: [patch] "HT scheduler", sched-2.5.63-B3

Ingo Molnar (mingo@elte.hu)
Thu, 6 Mar 2003 18:13:20 +0100 (CET)


On Wed, 5 Mar 2003, Linus Torvalds wrote:

> p->sleep_avg += sleep_time;
> - if (p->sleep_avg > MAX_SLEEP_AVG)
> + if (p->sleep_avg > MAX_SLEEP_AVG) {
> + int ticks = p->sleep_avg - MAX_SLEEP_AVG + current->sleep_avg;
> p->sleep_avg = MAX_SLEEP_AVG;
> + if (ticks > MAX_SLEEP_AVG)
> + ticks = MAX_SLEEP_AVG;
> + if (!in_interrupt())
> + current->sleep_avg = ticks;
> + }
> +
> p->prio = effective_prio(p);

interesting approach, but it has one problem which so far i tried to
avoid: it makes it too easy for a process to gain a bonus. Until now
pretty much the only way to get an interactive bonus was to actually
sleep. Another rule was that interactivity is kept constant, ie. the only
'source' of interactivity was passing time, not some artificial activity
performed by any process. Even the timeslice passing across fork()/exit()
is controlled carefully to maintain the total sum of timeslices.

With the above code it's enough to keep a single helper thread around
which blocks on a pipe, to create an almost endless source of
interactivity bonus. And does not even have to be 'deliberate' - there's
tons of code that just waits for a CPU-bound task to finish (eg. 'make'
waiting for gcc to finish), and which processes/threads have a maximum
boost already, in which case the interactivity boost is not justified.

Anyway, Andrew, could you give Linus' patch a go as well?

Ingo

-
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/