[lkml]   [2003]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [patch] "HT scheduler", sched-2.5.63-B3

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?


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:33    [W:0.178 / U:3.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site