From dc543a5b2a11203705197a242285dac96a497fff Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Fri, 27 Nov 2020 18:22:13 +0530 Subject: [PATCH] ANDROID: sched: Add env->cpus to android_rvh_sched_nohz_balancer_kick android_rvh_sched_nohz_balancer_kick hook allows vendor modules to select the busiest CPU in a group during load balance. When the load balancer could not pull tasks from this busiest CPU due to affinity restriction, the CPU is cleared from env->cpu. This must be passed to the vendor module, otherwise we keep selecting the exempted CPU as the busiest CPU. Bug: 174338902 Change-Id: Iedaa389a51849da4c3e094d731fe5e39cd909d81 Signed-off-by: Pavankumar Kondeti --- include/trace/hooks/sched.h | 7 ++++--- kernel/sched/fair.c | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 06c4ebf83bf7..458fd5006414 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -92,8 +92,9 @@ DECLARE_RESTRICTED_HOOK(android_rvh_sched_nohz_balancer_kick, DECLARE_RESTRICTED_HOOK(android_rvh_find_busiest_queue, TP_PROTO(int dst_cpu, struct sched_group *group, - struct rq **busiest, int *done), - TP_ARGS(dst_cpu, group, busiest, done), 1); + struct cpumask *env_cpus, struct rq **busiest, + int *done), + TP_ARGS(dst_cpu, group, env_cpus, busiest, done), 1); DECLARE_RESTRICTED_HOOK(android_rvh_migrate_queued_task, TP_PROTO(struct rq *rq, struct rq_flags *rf, @@ -119,7 +120,7 @@ DECLARE_RESTRICTED_HOOK(android_rvh_migrate_queued_task, #define trace_android_vh_jiffies_update(unused) #define trace_android_rvh_sched_newidle_balance(this_rq, rf, pulled_task, done) #define trace_android_rvh_sched_nohz_balancer_kick(rq, flags, done) -#define trace_android_rvh_find_busiest_queue(dst_cpu, group, busiest, done) +#define trace_android_rvh_find_busiest_queue(dst_cpu, group, env_cpus, busiest, done) #define trace_android_rvh_migrate_queued_task(rq, rf, p, new_cpu, detached) #endif #endif /* _TRACE_HOOK_SCHED_H */ diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e2be45874114..422579da23fb 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9393,7 +9393,8 @@ static struct rq *find_busiest_queue(struct lb_env *env, unsigned int busiest_nr = 0; int i, done = 0; - trace_android_rvh_find_busiest_queue(env->dst_cpu, group, &busiest, &done); + trace_android_rvh_find_busiest_queue(env->dst_cpu, group, env->cpus, + &busiest, &done); if (done) return busiest;