sched/core: WARN() when migrating to an offline CPU
authorPeter Zijlstra <[email protected]>
Thu, 7 Sep 2017 15:03:52 +0000 (17:03 +0200)
committerIngo Molnar <[email protected]>
Tue, 12 Sep 2017 15:41:04 +0000 (17:41 +0200)
Migrating tasks to offline CPUs is a pretty big fail, warn about it.

Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
kernel/sched/core.c

index 136a76d80dbf6e6cfeb19a0b75a43f420b4789e6..18a6966567daf30517a9f832e4a88b20ae705401 100644 (file)
@@ -1173,6 +1173,10 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
        WARN_ON_ONCE(debug_locks && !(lockdep_is_held(&p->pi_lock) ||
                                      lockdep_is_held(&task_rq(p)->lock)));
 #endif
+       /*
+        * Clearly, migrating tasks to offline CPUs is a fairly daft thing.
+        */
+       WARN_ON_ONCE(!cpu_online(new_cpu));
 #endif
 
        trace_sched_migrate_task(p, new_cpu);