sched/walt: update select_task_rq_rt to filter halted cpus

walt_rt_energy_aware_wake_cpu could return -1, which makes
walt_select_task_rq_rt use the task's prev cpu (the backup cpu).
However, the backup_cpu could be halted.

Address this by replacing the chosen cpu with the lowest order non-halted
cpu in the system.

Change-Id: I366bd2e9093b945a093ae4542a77983b0bc57229
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
This commit is contained in:
Stephen Dickey 2022-01-19 11:31:11 -08:00 committed by Rishabh Bhatnagar
parent 0c44eb86b4
commit 5d6c9601a0

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2020-2022, The Linux Foundation. All rights reserved.
*/
#include <trace/hooks/sched.h>
@ -217,6 +217,17 @@ static void walt_select_task_rq_rt(void *unused, struct task_struct *task, int c
(may_not_preempt || task->prio < cpu_rq(target)->rt.highest_prio.curr))
*new_cpu = target;
/* if backup or chosen cpu is halted, pick something else */
if (cpu_halted(*new_cpu)) {
cpumask_t non_halted;
/* choose the lowest-order, unhalted, allowed CPU */
cpumask_andnot(&non_halted, task->cpus_ptr, cpu_halt_mask);
target = cpumask_first(&non_halted);
if (target < nr_cpu_ids)
*new_cpu = target;
}
rcu_read_unlock();
}