From 4fb4acb57cea3ec3ab908b5145f3caa3d25073bd Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Fri, 22 Jan 2021 08:39:40 +0530 Subject: [PATCH] sched/walt: Improve the scheduler This change is for general scheduler improvement. Change-Id: I30b3899e191d880e741f922323d0826b5c292498 Signed-off-by: Pavankumar Kondeti --- kernel/sched/walt/walt_cfs.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/kernel/sched/walt/walt_cfs.c b/kernel/sched/walt/walt_cfs.c index c5548f0e626e..a1a471a10663 100644 --- a/kernel/sched/walt/walt_cfs.c +++ b/kernel/sched/walt/walt_cfs.c @@ -209,18 +209,27 @@ static void walt_find_best_target(struct sched_domain *sd, int prev_cpu = task_cpu(p); int active_candidate = -1; int order_index = fbt_env->order_index, end_index = fbt_env->end_index; + int stop_index = INT_MAX; int cluster; unsigned int target_nr_rtg_high_prio = UINT_MAX; bool rtg_high_prio_task = task_rtg_high_prio(p); cpumask_t visit_cpus; struct walt_task_struct *wts = (struct walt_task_struct *) p->android_vendor_data1; - bool io_task_pack = (order_index > 0 && wts->iowaited); struct cfs_rq *cfs_rq; /* Find start CPU based on boost value */ start_cpu = fbt_env->start_cpu; - if (fbt_env->strict_max || io_task_pack) + /* + * For higher capacity worth I/O tasks, stop the search + * at the end of higher capacity cluster(s). + */ + if (order_index > 0 && wts->iowaited) { + stop_index = num_sched_clusters - 2; + most_spare_wake_cap = LONG_MIN; + } + + if (fbt_env->strict_max) target_max_spare_cap = LONG_MIN; if (p->state == TASK_RUNNING) @@ -296,8 +305,7 @@ static void walt_find_best_target(struct sched_domain *sd, * than the one required to boost the task. */ new_util = max(min_util, new_util); - if (!(fbt_env->strict_max || io_task_pack) && - new_util > capacity_orig) + if (!fbt_env->strict_max && new_util > capacity_orig) continue; /* @@ -386,6 +394,9 @@ static void walt_find_best_target(struct sched_domain *sd, if ((cluster >= end_index) && (target_cpu != -1) && walt_target_ok(target_cpu, order_index)) break; + + if (most_spare_cap_cpu != -1 && cluster >= stop_index) + break; } if (best_idle_cpu != -1)