aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <[email protected]>2021-11-29 18:46:44 +0100
committerPeter Zijlstra <[email protected]>2021-12-04 10:56:22 +0100
commit9d0df37797453f168afdb2e6fd0353c73718ae9a (patch)
tree31ff628d481cc9c76881994ff59d69840c3e5a4c
parent4e0d84634445ed550498d613a49ea8f6cfa5e66c (diff)
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--kernel/sched/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 3c9b0fda64ac..300218ad98a2 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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().