Rik van Riel wrote:
>
> Hi,
>
> I've noticed some strange and unneeded CPU switching
> lately (who hasn't) and have come up with a simple
> fix.
>
> 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...
Hmm, off the top of my head: won't this break the counter-recharging
when (no jobs for this cpu && all jobs for other CPU(s) need recharging)
?
Neil
-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]