From 31f357a5004e08f0ac19c6f46285561c32c41bf2 Mon Sep 17 00:00:00 2001 From: Stephen Dickey Date: Thu, 3 Mar 2022 13:58:06 -0800 Subject: [PATCH] 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 --- kernel/sched/walt/walt_halt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/walt/walt_halt.c b/kernel/sched/walt/walt_halt.c index b7eb4dece2bb..8e4925f7b439 100644 --- a/kernel/sched/walt/walt_halt.c +++ b/kernel/sched/walt/walt_halt.c @@ -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);