Re: [patch] SMP scheduler improvements

Andrea Arcangeli (andrea@suse.de)
Sat, 21 Aug 1999 16:05:25 +0200 (CEST)


On Sat, 21 Aug 1999, Andrea Arcangeli wrote:

>On Fri, 20 Aug 1999, Jonathan Case Nicklin wrote:
>
>>Also, it looks to me like you removed some code in reschedule_idle
>>necessary for good real-time performace, in particular, evaluating the
>>preemptive_goodness of a task vs all of the tasks on all other CPU's.
>
>Agreed. If the p->policy of the wakenup task is SCHED_RT or SCHED_FIFO I
^ R
>should try to reschedule all the running tasks (not only the one that runs
>in the p->processor CPU).

Here it is the sched-RT performance optimization against 2.3.15-pre1:

--- 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;

The #if 1 is there because the code would work also in the other way
(allowing not only the RT policy but also the regular tasks to try
rescheduling all busy not preferred cpus if none CPU is idle), but I
really don't think it's a good idea to do that (mostly with lots of CPU in
the system). Anyway if somebody want to try out to reschedule the wakenup
task as much as possible, he now can easily try to #if 0 the code above.

The parallel SMP-scheduler patch with the RT improvement against
2.2.12-final is here:

ftp://e-mind.com/pub/andrea/kernel-patches/my-2.2.12-final/SMP-scheduler-2.2.11-E

Andrea

-
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/