stop_machine: Kill smp_hotplug_thread->pre_unpark, introduce stop_machine_unpark()
1. Change smpboot_unpark_thread() to check ->selfparking, just
like smpboot_park_thread() does.
2. Introduce stop_machine_unpark() which sets ->enabled and calls
kthread_unpark().
3. Change smpboot_thread_call() and cpu_stop_init() to call
stop_machine_unpark() by hand.
This way:
- IMO the ->selfparking logic becomes more consistent.
- We can kill the smp_hotplug_thread->pre_unpark() method.
- We can easily unpark the stopper thread earlier. Say, we
can move stop_machine_unpark() from smpboot_thread_call()
to sched_cpu_active() as Peter suggests.
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/20151009160049.GA10166@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
committed by
Ingo Molnar
parent
d8bc853582
commit
c00166d87e
@@ -513,6 +513,14 @@ static void cpu_stop_unpark(unsigned int cpu)
|
||||
spin_unlock_irq(&stopper->lock);
|
||||
}
|
||||
|
||||
void stop_machine_unpark(int cpu)
|
||||
{
|
||||
struct cpu_stopper *stopper = &per_cpu(cpu_stopper, cpu);
|
||||
|
||||
cpu_stop_unpark(cpu);
|
||||
kthread_unpark(stopper->thread);
|
||||
}
|
||||
|
||||
static struct smp_hotplug_thread cpu_stop_threads = {
|
||||
.store = &cpu_stopper.thread,
|
||||
.thread_should_run = cpu_stop_should_run,
|
||||
@@ -521,7 +529,6 @@ static struct smp_hotplug_thread cpu_stop_threads = {
|
||||
.create = cpu_stop_create,
|
||||
.setup = cpu_stop_unpark,
|
||||
.park = cpu_stop_park,
|
||||
.pre_unpark = cpu_stop_unpark,
|
||||
.selfparking = true,
|
||||
};
|
||||
|
||||
@@ -537,6 +544,7 @@ static int __init cpu_stop_init(void)
|
||||
}
|
||||
|
||||
BUG_ON(smpboot_register_percpu_thread(&cpu_stop_threads));
|
||||
stop_machine_unpark(raw_smp_processor_id());
|
||||
stop_machine_initialized = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user