]> Git Repo - linux.git/commitdiff
Revert "sched/core: Do not use smp_processor_id() with preempt enabled in smpboot_thr...
authorIngo Molnar <[email protected]>
Tue, 4 Oct 2016 07:55:57 +0000 (09:55 +0200)
committerIngo Molnar <[email protected]>
Tue, 4 Oct 2016 07:55:57 +0000 (09:55 +0200)
This reverts commit 4fa5cd5245b627db88c9ca08ae442373b02596b4.

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 <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Cc: Con Kolivas <[email protected]>
Cc: Alfred Chen <[email protected]>
Link: http://lkml.kernel.org/r/20160930015102.GB20189@yexl-desktop
Signed-off-by: Ingo Molnar <[email protected]>
kernel/smpboot.c

index fc0d8270f69ed412947df06890f80602f68f6ff6..13bc43d1fb227f8ee0c55a411460200a2ac3b067 100644 (file)
@@ -122,12 +122,12 @@ static int smpboot_thread_fn(void *data)
 
                if (kthread_should_park()) {
                        __set_current_state(TASK_RUNNING);
+                       preempt_enable();
                        if (ht->park && td->status == HP_THREAD_ACTIVE) {
                                BUG_ON(td->cpu != smp_processor_id());
                                ht->park(td->cpu);
                                td->status = HP_THREAD_PARKED;
                        }
-                       preempt_enable();
                        kthread_parkme();
                        /* We might have been woken for stop */
                        continue;
This page took 0.057826 seconds and 4 git commands to generate.