sched: Trigger warning if ->migration_disabled counter underflows.

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
This commit is contained in:
Sebastian Andrzej Siewior 2021-11-29 18:46:44 +01:00 коммит произвёл Peter Zijlstra
Родитель 4e0d846344
Коммит 9d0df37797
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

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