[uPATCH] SMP scheduling fix (?)

Rik van Riel (riel@humbolt.geo.uu.nl)
Thu, 14 Jan 1999 22:18:29 +0100 (CET)


Hi Linus,

I (and other people?) have noted that, on SMP systems,
niced tasks get more CPU than they deserve. In fact,
you often see that 2 non-niced tasks have to share a
CPU while 2 niced tasks get the other CPU...

This is probably because the PROC_CHANGE_PENALTY is
_larger_ than the priority of the niced task to begin
with, so the niced task gets it's priority more than
doubled and the normal task can't get through...

This patch may fix the problem by giving a large bonus
to 'normal' processes and a smaller one to niced tasks.
It also removes the standard 'weight += p->priority'
because that one was a workaround for the bug in tty_ioctl.c
and we shouldn't need it any more now that that's fixed.

regards,

Rik -- If a Microsoft product fails, who do you sue?
+-------------------------------------------------------------------+
| Linux memory management tour guide. riel@nl.linux.org |
| Scouting Vries cubscout leader. http://www.nl.linux.org/~riel |
+-------------------------------------------------------------------+

--- kernel/sched.c.old
+++ kernel/sched.c
@@ -365,13 +365,12 @@
/* Give a largish advantage to the same processor... */
/* (this is equivalent to penalizing other processors) */
if (p->processor == this_cpu)
- weight += PROC_CHANGE_PENALTY;
#endif
+ weight += p->priority;

/* .. and a slight advantage to the current thread */
if (p->mm == prev->mm)
weight += 1;
- weight += p->priority;
}

return weight;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/