Skip to content

Commit be6a2e4

Browse files
committed
Revert "sched/core: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn()"
This reverts commit 4fa5cd5. The original change widens a preempt-off section, to avoid a seemingly unsafe smp_processor_id() use. During review I overlooked two facts: - The code to calls a non-trivial function callback: ht->park(td->cpu); ... which might (and does occasionally) sleep, triggering the warning. - More importantly, as pointed out by Peter Zijlstra, using smp_processor_id() in that context is safe, if it's done from a kernel thread that is pinned to a single CPU - which is the case here. So revert to the original code that enables preemption sooner. Reported-by: kernel test robot <xiaolong.ye@intel.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Con Kolivas <kernel@kolivas.org> Cc: Alfred Chen <cchalpha@gmail.com> Link: http://lkml.kernel.org/r/20160930015102.GB20189@yexl-desktop Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 597f03f commit be6a2e4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎kernel/smpboot.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ static int smpboot_thread_fn(void *data)
122122

123123
if (kthread_should_park()) {
124124
__set_current_state(TASK_RUNNING);
125+
preempt_enable();
125126
if (ht->park && td->status == HP_THREAD_ACTIVE) {
126127
BUG_ON(td->cpu != smp_processor_id());
127128
ht->park(td->cpu);
128129
td->status = HP_THREAD_PARKED;
129130
}
130-
preempt_enable();
131131
kthread_parkme();
132132
/* We might have been woken for stop */
133133
continue;

0 commit comments

Comments
 (0)