<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Ingo Molnar &lt;mingo@elte.hu&gt;

Do wakeup-balancing only if the wakeup-CPU (or any of its siblings) is
idle.

This prevents excessive wakeup-balancing while the system is highly loaded,
but helps spread out the workload on partly idle systems.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 kernel/sched.c |    6 ++++++
 1 files changed, 6 insertions(+)

diff -puN kernel/sched.c~sched-better-wake-balancing-3 kernel/sched.c
--- devel/kernel/sched.c~sched-better-wake-balancing-3	2005-08-21 23:49:39.000000000 -0700
+++ devel-akpm/kernel/sched.c	2005-08-21 23:49:39.000000000 -0700
@@ -1255,7 +1255,13 @@ static int try_to_wake_up(task_t *p, uns
 	if (unlikely(task_running(rq, p)))
 		goto out_activate;
 
+	/*
+	 * Only do wakeup-balancing (== potentially migrate the task)
+	 * if this CPU (or any SMT sibling) is idle:
+	 */
 	new_cpu = cpu;
+	if (!idle_cpu(this_cpu) &amp;&amp; this_cpu == wake_idle(this_cpu, p))
+		goto out_set_cpu;
 
 	schedstat_inc(rq, ttwu_cnt);
 	if (cpu == this_cpu) {
_
</pre></body></html>