diff options
author | Peter Zijlstra <peterz@infradead.org> | 2015-10-09 12:00:54 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-10-20 04:25:55 -0400 |
commit | 07f06cb3b5f6bd21374a48dbefdb431d71d53974 (patch) | |
tree | 80eafc844814f3a7fbc64191e1721a39f59aec37 | |
parent | f0cf16cbd0659d2dd21352da9f06f3fab7a51596 (diff) |
sched: Start stopper early
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: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: heiko.carstens@de.ibm.com
Link: http://lkml.kernel.org/r/20151009160054.GA10176@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | kernel/cpu.c | 1 | ||||
-rw-r--r-- | kernel/sched/core.c | 12 |
2 files changed, 9 insertions, 4 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 6467521e1e15..c85df2775b73 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -475,7 +475,6 @@ static int smpboot_thread_call(struct notifier_block *nfb, | |||
475 | 475 | ||
476 | case CPU_DOWN_FAILED: | 476 | case CPU_DOWN_FAILED: |
477 | case CPU_ONLINE: | 477 | case CPU_ONLINE: |
478 | stop_machine_unpark(cpu); | ||
479 | smpboot_unpark_threads(cpu); | 478 | smpboot_unpark_threads(cpu); |
480 | break; | 479 | break; |
481 | 480 | ||
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index f45a7c70f264..7ee8caea1195 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -5545,21 +5545,27 @@ static void set_cpu_rq_start_time(void) | |||
5545 | static int sched_cpu_active(struct notifier_block *nfb, | 5545 | static int sched_cpu_active(struct notifier_block *nfb, |
5546 | unsigned long action, void *hcpu) | 5546 | unsigned long action, void *hcpu) |
5547 | { | 5547 | { |
5548 | int cpu = (long)hcpu; | ||
5549 | |||
5548 | switch (action & ~CPU_TASKS_FROZEN) { | 5550 | switch (action & ~CPU_TASKS_FROZEN) { |
5549 | case CPU_STARTING: | 5551 | case CPU_STARTING: |
5550 | set_cpu_rq_start_time(); | 5552 | set_cpu_rq_start_time(); |
5551 | return NOTIFY_OK; | 5553 | return NOTIFY_OK; |
5554 | |||
5552 | case CPU_ONLINE: | 5555 | case CPU_ONLINE: |
5553 | /* | 5556 | /* |
5554 | * At this point a starting CPU has marked itself as online via | 5557 | * At this point a starting CPU has marked itself as online via |
5555 | * set_cpu_online(). But it might not yet have marked itself | 5558 | * set_cpu_online(). But it might not yet have marked itself |
5556 | * as active, which is essential from here on. | 5559 | * as active, which is essential from here on. |
5557 | * | ||
5558 | * Thus, fall-through and help the starting CPU along. | ||
5559 | */ | 5560 | */ |
5561 | set_cpu_active(cpu, true); | ||
5562 | stop_machine_unpark(cpu); | ||
5563 | return NOTIFY_OK; | ||
5564 | |||
5560 | case CPU_DOWN_FAILED: | 5565 | case CPU_DOWN_FAILED: |
5561 | set_cpu_active((long)hcpu, true); | 5566 | set_cpu_active(cpu, true); |
5562 | return NOTIFY_OK; | 5567 | return NOTIFY_OK; |
5568 | |||
5563 | default: | 5569 | default: |
5564 | return NOTIFY_DONE; | 5570 | return NOTIFY_DONE; |
5565 | } | 5571 | } |