sched: walt: always return an active cpu as timer target

There is a possibility of all the cpus in the system either
inactive or paused, this could lead to a situation where WALT
as part of nohz_timer_target vendor hook returns an offline cpu
as timers target cpu.

Handle the above case by ensuring WALT returns a paused cpu if
it doesn't find any active or un-pause cpu.
WALT will prefer core control paused cpu before returning cpu
paused by external client(thermal).

Change-Id: I9887861bbd5d477c971036d48d152a534a27d177
Signed-off-by: Ashay Jaiswal <quic_ashayj@quicinc.com>
This commit is contained in:
Ashay Jaiswal 2023-10-10 09:59:23 +05:30
parent d9cc7fb819
commit 8890872a08
3 changed files with 15 additions and 1 deletions

View File

@ -22,7 +22,7 @@
#include "trace.h"
/* mask of all CPUs with a fully pause claim outstanding */
static cpumask_t cpus_paused_by_us = { CPU_BITS_NONE };
cpumask_t cpus_paused_by_us = { CPU_BITS_NONE };
/* mask of all CPUS with a partial pause claim outstanding */
static cpumask_t cpus_part_paused_by_us = { CPU_BITS_NONE };

View File

@ -176,6 +176,7 @@ struct walt_sched_cluster {
extern struct walt_sched_cluster *sched_cluster[WALT_NR_CPUS];
extern cpumask_t part_haltable_cpus;
extern cpumask_t cpus_paused_by_us;
/*END SCHED.H PORT*/
extern int num_sched_clusters;

View File

@ -517,6 +517,19 @@ static void android_rvh_get_nohz_timer_target(void *unused, int *cpu, bool *done
default_cpu = *cpu;
}
/*
* 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(&cpus_paused_by_us))
*cpu = cpumask_first(&cpus_paused_by_us);
else
*cpu = cpumask_first(cpu_halt_mask);
return;
}
rcu_read_lock();
for_each_domain(*cpu, sd) {
for_each_cpu_and(i, sched_domain_span(sd),