mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
ANDROID: sched: Don't allow frozen asymmetric tasks to remain on the rq
If a task with a restricted possible CPU mask and PF_FROZEN or PF_FREEZER_SKIP set blocks, then we must not put it back on the runqueue to handle a signal because this could lead to migration failures later on if the suspending CPU is not capable of running it. Return such a task to the runqueue only if a fatal signal is pending, and otherwise allow the task to block. Bug: 202918514 Signed-off-by: Will Deacon <willdeacon@google.com> Change-Id: I04cc9e65751f2bffc556c4da9ef02fe386764324
This commit is contained in:
@@ -4618,6 +4618,23 @@ restart:
|
||||
BUG();
|
||||
}
|
||||
|
||||
static bool __task_can_run(struct task_struct *prev)
|
||||
{
|
||||
if (__fatal_signal_pending(prev))
|
||||
return true;
|
||||
|
||||
if (!frozen_or_skipped(prev))
|
||||
return true;
|
||||
|
||||
/*
|
||||
* We can't safely go back on the runqueue if we're an asymmetric
|
||||
* task skipping the freezer. Doing so can lead to migration failures
|
||||
* later on if there aren't any suitable CPUs left around for us to
|
||||
* move to.
|
||||
*/
|
||||
return task_cpu_possible_mask(prev) == cpu_possible_mask;
|
||||
}
|
||||
|
||||
/*
|
||||
* __schedule() is the main scheduler function.
|
||||
*
|
||||
@@ -4711,7 +4728,7 @@ static void __sched notrace __schedule(bool preempt)
|
||||
*/
|
||||
prev_state = prev->state;
|
||||
if (!preempt && prev_state) {
|
||||
if (signal_pending_state(prev_state, prev)) {
|
||||
if (signal_pending_state(prev_state, prev) && __task_can_run(prev)) {
|
||||
prev->state = TASK_RUNNING;
|
||||
} else {
|
||||
prev->sched_contributes_to_load =
|
||||
|
||||
Reference in New Issue
Block a user