Signed-off-by: Kirill Tkhai <[email protected]>
CC: Thomas Gleixner <[email protected]>
---
kernel/smpboot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index eb89e18..c6e1c56 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -152,7 +152,7 @@ static int smpboot_thread_fn(void *data)
}
if (!ht->thread_should_run(td->cpu)) {
- preempt_enable();
+ preempt_enable_no_resched();
schedule();
} else {
set_current_state(TASK_RUNNING);
On Wed, 12 Feb 2014, Kirill Tkhai wrote:
No, preempt_enable_no_resched() should just die. If you want to get
rid of the preempt_enable() / schedule() sequence just use
schedule_preempt_disabled(). See below.
Thanks,
tglx
--- linux-2.6.orig/kernel/smpboot.c
+++ linux-2.6/kernel/smpboot.c
@@ -106,9 +106,9 @@ static int smpboot_thread_fn(void *data)
struct smpboot_thread_data *td = data;
struct smp_hotplug_thread *ht = td->ht;
+ preempt_disable();
while (1) {
set_current_state(TASK_INTERRUPTIBLE);
- preempt_disable();
if (kthread_should_stop()) {
set_current_state(TASK_RUNNING);
preempt_enable();
@@ -128,6 +128,7 @@ static int smpboot_thread_fn(void *data)
}
kthread_parkme();
/* We might have been woken for stop */
+ preempt_disable();
continue;
}
@@ -152,12 +153,12 @@ static int smpboot_thread_fn(void *data)
}
if (!ht->thread_should_run(td->cpu)) {
- preempt_enable();
- schedule();
+ schedule_preempt_disabled();
} else {
set_current_state(TASK_RUNNING);
preempt_enable();
ht->thread_fn(td->cpu);
+ preempt_disable();
}
}
}