From b18d15cb16d08d750b2d0d6e77c81acf2c5b6cce Mon Sep 17 00:00:00 2001 From: Shaleen Agrawal Date: Wed, 15 Jun 2022 17:39:30 -0700 Subject: [PATCH] sched/walt: Check reserved CPU during walt_newidle_balance Currently, it is observed that multiple calls to active_load_balance can take place. For example, say two Big threads are running on Golds, and become misfits at the same time. Then, Prime which is currently say halted, will end up pulling both threads. This is because first, as Prime is unhalted, the CPU is kicked to enable it to pull tasks. However, while Prime is kicked, it goes back to idle briefly, causing the upstream newidle_balance path to come into play. As a consequence, both threads are queued on Prime, and eventually, the one sitting in the runqueue is put back on a Gold. This behavior is unoptimal and unnecessary. Ensure that walt_newidle_balance only takes when the CPU is not marked as reserved. Change-Id: I00feb8df3c4433333a356f2e855fb7a3ee848789 Signed-off-by: Shaleen Agrawal --- kernel/sched/walt/walt_lb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/sched/walt/walt_lb.c b/kernel/sched/walt/walt_lb.c index 4d03bee065f5..e9aa3770cad6 100644 --- a/kernel/sched/walt/walt_lb.c +++ b/kernel/sched/walt/walt_lb.c @@ -783,9 +783,6 @@ static void walt_newidle_balance(void *unused, struct rq *this_rq, if (unlikely(walt_disabled)) return; - /*Cluster isn't initialized until after WALT is enabled*/ - order_index = wrq->cluster->id; - /* * newly idle load balance is completely handled here, so * set done to skip the load balance by the caller. @@ -806,6 +803,12 @@ static void walt_newidle_balance(void *unused, struct rq *this_rq, if (cpu_halted(this_cpu)) return; + if (is_reserved(this_cpu)) + return; + + /*Cluster isn't initialized until after WALT is enabled*/ + order_index = wrq->cluster->id; + rq_unpin_lock(this_rq, rf); /*