diff --git a/kernel/sched/walt/walt_halt.c b/kernel/sched/walt/walt_halt.c index dbfcff2bb84c..e77a6cb844a1 100644 --- a/kernel/sched/walt/walt_halt.c +++ b/kernel/sched/walt/walt_halt.c @@ -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;