--- 2.3.47/kernel/sched.c.~1~ Mon Feb 21 15:17:35 2000 +++ 2.3.47/kernel/sched.c Wed Feb 23 20:41:10 2000 @@ -233,16 +233,25 @@ * cpu won't reschedule shortly. */ if ((p->avg_slice < cacheflush_time && cpu_curr(best_cpu)->avg_slice > cacheflush_time) || - p->policy != SCHED_OTHER) + ((p->policy & ~SCHED_YIELD) != SCHED_OTHER)) { + int weight, best_weight = 0; + struct task_struct best_tsk = NULL; + for (i = smp_num_cpus - 1; i >= 0; i--) { cpu = cpu_logical_map(i); if (cpu == best_cpu) continue; tsk = cpu_curr(cpu); - if (preemption_goodness(tsk, p, cpu) > 0) - goto send_now; + weight = preemption_goodness(tsk, p, cpu); + if (weight > best_weight) { + best_weight = weight; + best_tsk = tsk; + } } + + if ((tsk = best_tsk)) + goto send_now; } spin_unlock_irqrestore(&runqueue_lock, flags);