From 0505931c2b97055305f9e102cc483ee7f2e78026 Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Fri, 12 Feb 2021 15:39:09 +0530 Subject: [PATCH] sched/walt: Use unbounded cpu util in load balancer The utilization return by cpu_util() is bounded by the original capacity of the CPU. Load balancer uses the utilization to break the ties. Use unbounded cpu utilization so that the most loaded CPU gets help. Change-Id: Id16cea205e6eb07a42a1e86fda533cd825df6908 Signed-off-by: Pavankumar Kondeti --- kernel/sched/walt/walt_lb.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kernel/sched/walt/walt_lb.c b/kernel/sched/walt/walt_lb.c index 0e60824e0381..61972bf366fa 100644 --- a/kernel/sched/walt/walt_lb.c +++ b/kernel/sched/walt/walt_lb.c @@ -8,6 +8,13 @@ #include "walt.h" #include "trace.h" +static inline unsigned long walt_lb_cpu_util(int cpu) +{ + struct walt_rq *wrq = (struct walt_rq *) cpu_rq(cpu)->android_vendor_data1; + + return wrq->walt_stats.cumulative_runnable_avg_scaled; +} + static void walt_detach_task(struct task_struct *p, struct rq *src_rq, struct rq *dst_rq) { @@ -327,7 +334,7 @@ static int walt_lb_find_busiest_similar_cap_cpu(int dst_cpu, const cpumask_t *sr if (cpu_rq(i)->cfs.h_nr_running < 2) continue; - util = cpu_util(i); + util = walt_lb_cpu_util(i); if (util < busiest_util) continue; @@ -358,7 +365,7 @@ static int walt_lb_find_busiest_higher_cap_cpu(int dst_cpu, const cpumask_t *src wrq = (struct walt_rq *) cpu_rq(i)->android_vendor_data1; trace_walt_lb_cpu_util(i, wrq); - util = cpu_util(i); + util = walt_lb_cpu_util(i); total_cpus += 1; total_util += util; total_capacity += capacity_orig_of(i); @@ -426,7 +433,7 @@ static int walt_lb_find_busiest_lower_cap_cpu(int dst_cpu, const cpumask_t *src_ trace_walt_lb_cpu_util(i, wrq); - util = cpu_util(i); + util = walt_lb_cpu_util(i); total_cpus += 1; total_util += util; total_capacity += capacity_orig_of(i);