Skip to content

Commit e681dcb

Browse files
Sebastian Andrzej SiewiorPeter Zijlstra
authored andcommitted
sched: Fix get_push_task() vs migrate_disable()
push_rt_task() attempts to move the currently running task away if the next runnable task has migration disabled and therefore is pinned on the current CPU. The current task is retrieved via get_push_task() which only checks for nr_cpus_allowed == 1, but does not check whether the task has migration disabled and therefore cannot be moved either. The consequence is a pointless invocation of the migration thread which correctly observes that the task cannot be moved. Return NULL if the task has migration disabled and cannot be moved to another CPU. Fixes: a7c8155 ("sched: Fix migrate_disable() vs rt/dl balancing") Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20210826133738.yiotqbtdaxzjsnfj@linutronix.de
1 parent 3c474b3 commit e681dcb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/sched/sched.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,6 +2255,9 @@ static inline struct task_struct *get_push_task(struct rq *rq)
22552255
if (p->nr_cpus_allowed == 1)
22562256
return NULL;
22572257

2258+
if (p->migration_disabled)
2259+
return NULL;
2260+
22582261
rq->push_busy = true;
22592262
return get_task_struct(p);
22602263
}

0 commit comments

Comments
 (0)