From 4bc53e5700b3a11cfb5fff5c5e28797d2db510c9 Mon Sep 17 00:00:00 2001 From: Shaleen Agrawal Date: Tue, 20 Apr 2021 14:09:01 -0700 Subject: [PATCH] sched: walt: Move spare_cap calculation spare_cap is being calculated prior to idle_cpu evaluation. If an idle cpu is found, then we have no need to go through this operation. As such, move the computation to after idle cpu evaluation. Change-Id: I86ff39909f2f0cb096ac39d02b6171838c257357 Signed-off-by: Shaleen Agrawal --- kernel/sched/walt/walt_cfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/sched/walt/walt_cfs.c b/kernel/sched/walt/walt_cfs.c index f667f0fcf8ac..20cd6e800d69 100644 --- a/kernel/sched/walt/walt_cfs.c +++ b/kernel/sched/walt/walt_cfs.c @@ -263,13 +263,6 @@ static void walt_find_best_target(struct sched_domain *sd, if (new_util > capacity_orig) continue; - /* - * Pre-compute the maximum possible capacity we expect - * to have available on this CPU once the task is - * enqueued here. - */ - spare_cap = capacity_orig - new_util; - /* * Find an optimal backup IDLE CPU for non latency * sensitive tasks. @@ -313,6 +306,13 @@ static void walt_find_best_target(struct sched_domain *sd, continue; } + /* + * Compute the maximum possible capacity we expect + * to have available on this CPU once the task is + * enqueued here. + */ + spare_cap = capacity_orig - new_util; + /* * Try to spread the rtg high prio tasks so that they * don't preempt each other. This is a optimisitc