--- 2.3.15-pre1/kernel/sched.c Fri Aug 20 17:43:24 1999 +++ /tmp/sched.c Sat Aug 21 14:46:19 1999 @@ -262,7 +262,35 @@ * found any suitable CPU? */ if (!target_tsk) - goto out_no_target; + { + int best_weight; + +#if 1 + if ((p->policy & ~SCHED_YIELD) == SCHED_OTHER) + goto out_no_target; +#endif + + /* This is a realtime task so try to reschedule all + CPUs (that maybe are running SCHED_OTHER tasks), + to decrease the scheduler latency. */ + for (best_weight = i = 0; i < smp_num_cpus; i++) { + int weight; + + cpu = cpu_logical_map(i); + if (cpu == best_cpu) + /* just checked previously */ + continue; + tsk = cpu_curr(cpu); + weight = preemption_goodness(tsk, p, cpu); + if (weight > best_weight) + { + best_weight = weight; + target_tsk = tsk; + } + } + if (!target_tsk) + goto out_no_target; + } send_now: target_cpu = target_tsk->processor;