Skip to content

Commit

Permalink
sched: Trigger warning if ->migration_disabled counter underflows.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sebastian Andrzej Siewior committed Sep 13, 2021
1 parent 8e6a53c commit 291578e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2148,6 +2148,8 @@ void migrate_enable(void)
if (p->migration_disabled > 1) {
p->migration_disabled--;
return;
} else if (WARN_ON_ONCE(p->migration_disabled == 0)) {
return;
}

/*
Expand Down

0 comments on commit 291578e

Please sign in to comment.