]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
sched: Trigger warning if ->migration_disabled counter underflows.
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Mon, 29 Nov 2021 17:46:44 +0000 (18:46 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Sat, 4 Dec 2021 09:56:22 +0000 (10:56 +0100)
If migrate_enable() is used more often than its counter part then it
remains undetected and rq::nr_pinned will underflow, too.

Add a warning if migrate_enable() is attempted if without a matching a
migrate_disable().

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20211129174654.668506-2-bigeasy@linutronix.de
kernel/sched/core.c

index 3c9b0fda64ac08b00723227bad6203279d8a9b1b..300218ad98a2498bfa99f1275b2beef27c163c3c 100644 (file)
@@ -2173,6 +2173,9 @@ void migrate_enable(void)
                return;
        }
 
+       if (WARN_ON_ONCE(!p->migration_disabled))
+               return;
+
        /*
         * Ensure stop_task runs either before or after this, and that
         * __set_cpus_allowed_ptr(SCA_MIGRATE_ENABLE) doesn't schedule().