sched/walt/halt: prevent migration of migration_disabled tasks

Prior to the introduction of the PREEMPT_RT, migrate_disable()
was introduced to support PREEMPT_RT. Many places throughout the
code avoid using migrate_disable() if PREEMPT_RT is not set.
However, bpf related code makes no such precautions, which is
enabled.

migrate_tasks() will forcefully migrate tasks off of this cpu
without regard for migration_disabled state of the task. This
causes a warning when attempting to migrate a migration_disabled
task, and may have other unforseen consequences.

Prevent migrate_tasks from moving tasks for which migration is
disabled.

Change-Id: I04aef81611c8d4df8e2abbd7833b8b12ec146548
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
This commit is contained in:
Stephen Dickey 2022-03-03 13:58:06 -08:00 committed by Rishabh Bhatnagar
parent 8ecbc9e106
commit 31f357a500

View File

@ -150,7 +150,7 @@ static void migrate_tasks(struct rq *dead_rq, struct rq_flags *rf)
/* Find suitable destination for @next */
dest_cpu = select_fallback_rq(dead_rq->cpu, next);
if (cpu_of(rq) != dest_cpu) {
if (cpu_of(rq) != dest_cpu && !is_migration_disabled(next)) {
/* only perform a required migration */
rq = __migrate_task(rq, rf, next, dest_cpu);