Commit 7d4d2696 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

sched, smp: Correctly deal with nested sleeps

smp_hotplug_thread::{setup,unpark} functions can sleep too, so be
consistent and do the same for all callbacks.

 __might_sleep+0x74/0x80
 kmem_cache_alloc_trace+0x4e/0x1c0
 perf_event_alloc+0x55/0x450
 perf_event_create_kernel_counter+0x2f/0x100
 watchdog_nmi_enable+0x8d/0x160
 watchdog_enable+0x45/0x90
 smpboot_thread_fn+0xec/0x2b0
 kthread+0xe4/0x100
 ret_from_fork+0x7c/0xb0
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: tglx@linutronix.de
Cc: ilya.dryomov@inktank.com
Cc: umgwanakikbuti@gmail.com
Cc: oleg@redhat.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20140924082242.392279328@infradead.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 97d9e28d
...@@ -110,7 +110,7 @@ static int smpboot_thread_fn(void *data) ...@@ -110,7 +110,7 @@ static int smpboot_thread_fn(void *data)
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
preempt_disable(); preempt_disable();
if (kthread_should_stop()) { if (kthread_should_stop()) {
set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
preempt_enable(); preempt_enable();
if (ht->cleanup) if (ht->cleanup)
ht->cleanup(td->cpu, cpu_online(td->cpu)); ht->cleanup(td->cpu, cpu_online(td->cpu));
...@@ -136,26 +136,27 @@ static int smpboot_thread_fn(void *data) ...@@ -136,26 +136,27 @@ static int smpboot_thread_fn(void *data)
/* Check for state change setup */ /* Check for state change setup */
switch (td->status) { switch (td->status) {
case HP_THREAD_NONE: case HP_THREAD_NONE:
__set_current_state(TASK_RUNNING);
preempt_enable(); preempt_enable();
if (ht->setup) if (ht->setup)
ht->setup(td->cpu); ht->setup(td->cpu);
td->status = HP_THREAD_ACTIVE; td->status = HP_THREAD_ACTIVE;
preempt_disable(); continue;
break;
case HP_THREAD_PARKED: case HP_THREAD_PARKED:
__set_current_state(TASK_RUNNING);
preempt_enable(); preempt_enable();
if (ht->unpark) if (ht->unpark)
ht->unpark(td->cpu); ht->unpark(td->cpu);
td->status = HP_THREAD_ACTIVE; td->status = HP_THREAD_ACTIVE;
preempt_disable(); continue;
break;
} }
if (!ht->thread_should_run(td->cpu)) { if (!ht->thread_should_run(td->cpu)) {
preempt_enable(); preempt_enable_no_resched();
schedule(); schedule();
} else { } else {
set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
preempt_enable(); preempt_enable();
ht->thread_fn(td->cpu); ht->thread_fn(td->cpu);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment