On Mon, 21 Dec 1998, Rik van Riel wrote:
> It consists of replacing these lines (at 315 in sched.c):
>
> /* Give a largish advantage to the same processor... */
> /* (this is equivalent to penalizing other processors) */
> if (p->processor == this_cpu)
> weight += PROC_CHANGE_PENALTY;
>
> With:
> if (p->processor != this_cpu) {
> weight -= PROC_CHANGE_PENALTY;
> return weight;
> }
>
> It works because now the weight value for processes on other
> CPUs can drop below 0 so the process on this CPU will remain
> here even if it's timeslice is over. The reason it didn't work
> before is that the 'local' process didn't get it's bonus when
> it's time slice was over, effectively abolishing the CPU change
> penalty every DEF_PRIORITY/smp_num_cpus...
>
> The return is there so we don't do the weight += p->priority
> trick (which would undoubtedly return us to fast-switching
> behaviour).
You might as well make it be
if (p->processor != this_cpu)
return -1;
then. As far as I can tell, your patch essentially makes us _never_
schedule a process that has run on another CPU, unless we have nothing
else at all to do.
Whether that is sane behaviour or not I can't tell, but it does sound too
extreme for my taste.
Basically, I will _not_ accept patches like this unless they also come
with numbers to show that it improves performance, or some other basic
argument to show why it is definitely the correct thing to do.
A argument of "unnecessary" context switches is not very compelling.
"Unnecessary" is a problem only if it impacts performance adversely,
otherwise it tends to be only good for latency reasons.
Linus
-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]