[PATCH 3/3] sched: start stopper early

From: Oleg Nesterov
Date: Fri Oct 09 2015 - 12:04:26 EST


From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>

Ensure the stopper thread is active 'early', because the load balancer
pretty much assumes that its available. And when 'online && active' the
load-balancer is fully available.

Not only the numa balancing stop_two_cpus() caller relies on it, but
also the self migration stuff does, and at CPU_ONLINE time the cpu
really is 'free' to run anything.

Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
---
kernel/cpu.c | 1 -
kernel/sched/core.c | 5 ++++-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index ef52b3b..8a7225a 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -464,7 +464,6 @@ static int smpboot_thread_call(struct notifier_block *nfb,
switch (action & ~CPU_TASKS_FROZEN) {

case CPU_ONLINE:
- stop_machine_unpark(cpu);
smpboot_unpark_threads(cpu);
break;

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e691052..955c181 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5324,11 +5324,14 @@ static void __cpuinit set_cpu_rq_start_time(void)
static int sched_cpu_active(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
+ int cpu = (long)hcpu;
+
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_STARTING:
set_cpu_rq_start_time();
return NOTIFY_OK;
case CPU_ONLINE:
+ stop_machine_unpark(cpu);
/*
* At this point a starting CPU has marked itself as online via
* set_cpu_online(). But it might not yet have marked itself
@@ -5337,7 +5340,7 @@ static int sched_cpu_active(struct notifier_block *nfb,
* Thus, fall-through and help the starting CPU along.
*/
case CPU_DOWN_FAILED:
- set_cpu_active((long)hcpu, true);
+ set_cpu_active(cpu, true);
return NOTIFY_OK;
default:
return NOTIFY_DONE;
--
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/