sched: walt: always return active cpu as part of nohz timer vendor hook

There is a possibility where WALT will not find any non-idle unhalted
cpu as part on NOHZ timer target vendor hook and in that case WALT
returns first available unhalted CPU which might be an offline cpu.
Add check to always return an active cpu as timer target CPU.

Change-Id: I072909ba9316e96b61599aaf9d946c96bdf533f7
Signed-off-by: Ashay Jaiswal <quic_ashayj@quicinc.com>
This commit is contained in:
Ashay Jaiswal 2024-03-18 17:34:44 +05:30
parent e89de86893
commit 53e81c1e70

View file

@ -533,9 +533,10 @@ static void android_rvh_get_nohz_timer_target(void *unused, int *cpu, bool *done
{
int i, default_cpu = -1;
struct sched_domain *sd;
cpumask_t unhalted;
cpumask_t active_unhalted;
*done = true;
cpumask_andnot(&active_unhalted, cpu_active_mask, cpu_halt_mask);
if (housekeeping_cpu(*cpu, HK_TYPE_TIMER) && !cpu_halted(*cpu)) {
if (!available_idle_cpu(*cpu))
@ -547,7 +548,7 @@ static void android_rvh_get_nohz_timer_target(void *unused, int *cpu, bool *done
* find first cpu halted by core control and try to avoid
* affecting externally halted cpus.
*/
if (!cpumask_andnot(&unhalted, cpu_active_mask, cpu_halt_mask)) {
if (!cpumask_weight(&active_unhalted)) {
cpumask_t tmp_pause, tmp_part_pause, tmp_halt, *tmp;
cpumask_and(&tmp_part_pause, cpu_active_mask, &cpus_part_paused_by_us);
@ -580,8 +581,7 @@ static void android_rvh_get_nohz_timer_target(void *unused, int *cpu, bool *done
}
if (default_cpu == -1) {
cpumask_complement(&unhalted, cpu_halt_mask);
for_each_cpu_and(i, &unhalted,
for_each_cpu_and(i, &active_unhalted,
housekeeping_cpumask(HK_TYPE_TIMER)) {
if (*cpu == i)
continue;
@ -592,8 +592,8 @@ static void android_rvh_get_nohz_timer_target(void *unused, int *cpu, bool *done
}
}
/* no active, non-halted, not-idle, choose any */
default_cpu = cpumask_any(&unhalted);
/* choose any active unhalted cpu */
default_cpu = cpumask_any(&active_unhalted);
if (unlikely(default_cpu >= nr_cpu_ids))
goto unlock;