[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130925075341.GB3081@twins.programming.kicks-ass.net>
Date: Wed, 25 Sep 2013 09:53:41 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Ingo Molnar <mingo@...nel.org>
Cc: Mike Galbraith <bitbucket@...ine.de>, Paul Turner <pjt@...gle.com>,
Rik van Riel <riel@...hat.com>, linux-kernel@...r.kernel.org
Subject: [RFC][PATCH] sched: Avoid select_idle_sibling() for
wake_affine(.sync=true)
Subject: sched: Avoid select_idle_sibling() for wake_affine(.sync=true)
From: Peter Zijlstra <peterz@...radead.org>
Date: Wed Sep 25 08:28:39 CEST 2013
When a task is the only running task and does a sync wakeup; avoid
going through select_idle_sibling() as it doesn't know the current CPU
is going to be idle shortly.
Without this two sync wakers will ping-pong between CPUs for no
reason.
Suggested-by: Rik van Riel <riel@...hat.com>
Signed-off-by: Peter Zijlstra <peterz@...radead.org>
---
kernel/sched/fair.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3461,6 +3461,16 @@ select_task_rq_fair(struct task_struct *
if (cpu != prev_cpu && wake_affine(affine_sd, p, sync))
prev_cpu = cpu;
+ /*
+ * Don't bother with select_idle_sibling() in the case of a sync wakeup
+ * where we know the only running task will soon go away. Going
+ * through select_idle_sibling will only lead to pointless ping-pong.
+ */
+ if (sync && prev_cpu == cpu && cpu_rq(cpu)->nr_running == 1) {
+ new_cpu = cpu;
+ goto unlock;
+ }
+
new_cpu = select_idle_sibling(p, prev_cpu);
goto unlock;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists