mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 1/2] sched: check for prev_cpu == this_cpu in wake_affine()
@ 2010-03-05 18:39 Suresh Siddha
  2010-03-05 18:39 ` [patch 2/2] sched: fix select_idle_sibling() logic in select_task_rq_fair() Suresh Siddha
  2010-03-05 19:36 ` [patch 1/2] sched: check for prev_cpu == this_cpu in wake_affine() Mike Galbraith
  0 siblings, 2 replies; 12+ messages in thread
From: Suresh Siddha @ 2010-03-05 18:39 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Mike Galbraith
  Cc: Arjan van de Ven, linux-kernel, Vaidyanathan Srinivasan,
	Yanmin Zhang, Gautham R Shenoy, Suresh Siddha

[-- Attachment #1: fix_wake_affine.patch --]
[-- Type: text/plain, Size: 2083 bytes --]

On a single cpu system with SMT, in the scenario of one SMT thread being
idle with another SMT thread running a task and doing a non sync wakeup of
another task, we see (from the traces) that the woken up task ends up running
on the busy thread instead of the idle thread. Idle balancing that comes
in little bit later is fixing the scernaio.

But fixing this wake balance and running the woken up task directly on the
idle SMT thread improved the performance (phoronix 7zip compression workload)
by ~9% on an atom platform.

During the process wakeup, select_task_rq_fair() and wake_affine() makes
the decision to wakeup the task either on the previous cpu that the task
ran or the cpu that the task is currently woken up.

select_task_rq_fair() also goes through to see if there are any idle siblings
for the cpu that the task is woken up on. This is to ensure that we select
any idle sibling rather than choose a busy cpu.

In the above load scenario, it so happens that the prev_cpu (that the
task ran before) and this_cpu (where it is woken up currently) are the same. And
in this case, it looks like wake_affine() returns 0 and ultimately not selecting
the idle sibling chosen by select_idle_sibling() in select_task_rq_fair().
Further down the path of select_task_rq_fair(), we ultimately select
the currently running cpu (busy SMT thread instead of the idle SMT thread).

Check for prev_cpu == this_cpu in wake_affine() and no need to do
any fancy stuff(and ultimately taking wrong decisions) in this case.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
 kernel/sched_fair.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: tip/kernel/sched_fair.c
===================================================================
--- tip.orig/kernel/sched_fair.c
+++ tip/kernel/sched_fair.c
@@ -1252,6 +1252,10 @@ static int wake_affine(struct sched_doma
 	idx	  = sd->wake_idx;
 	this_cpu  = smp_processor_id();
 	prev_cpu  = task_cpu(p);
+
+	if (prev_cpu == this_cpu)
+		return 1;
+
 	load	  = source_load(prev_cpu, idx);
 	this_load = target_load(this_cpu, idx);
 



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-03-10 21:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-05 18:39 [patch 1/2] sched: check for prev_cpu == this_cpu in wake_affine() Suresh Siddha
2010-03-05 18:39 ` [patch 2/2] sched: fix select_idle_sibling() logic in select_task_rq_fair() Suresh Siddha
2010-03-05 20:25   ` Mike Galbraith
2010-03-06  8:21     ` Mike Galbraith
2010-03-08 22:24     ` Suresh Siddha
2010-03-09  6:05       ` Mike Galbraith
2010-03-09 13:27         ` Mike Galbraith
2010-03-10 21:14           ` Mike Galbraith
2010-03-06  8:36   ` Mike Galbraith
2010-03-05 19:36 ` [patch 1/2] sched: check for prev_cpu == this_cpu in wake_affine() Mike Galbraith
2010-03-08 19:09   ` Suresh Siddha
2010-03-08 22:25     ` Mike Galbraith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome