From 858f6f15415b003dd14b0d97d3fce4c00a1f7e7e Mon Sep 17 00:00:00 2001 From: Qais Yousef Date: Wed, 8 Feb 2023 18:17:04 +0000 Subject: [PATCH] ANDROID: sched/fair: unlink misfit from cpu overutilized Partially applies patch from Vincent Guittot e5ed0550c04c: ("sched/fair: unlink misfit task from cpu overutilized") The full patch improves the search logic under thermal pressure, but it's a bit intrusive to fully backport. We are interested in the part that unlinks misfit from overutilized only. Bug: 283975667 Signed-off-by: Qais Yousef Change-Id: I2ae21499b846d13d3889f8cacdb70652817b066f --- kernel/sched/fair.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 9cc230dcc34a..cc7565f1468f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9963,6 +9963,16 @@ static struct sched_group *find_busiest_group(struct lb_env *env) */ update_sd_lb_stats(env, &sds); + /* There is no busy sibling group to pull tasks from */ + if (!sds.busiest) + goto out_balanced; + + busiest = &sds.busiest_stat; + + /* Misfit tasks should be dealt with regardless of the avg load */ + if (busiest->group_type == group_misfit_task) + goto force_balance; + if (sched_energy_enabled()) { struct root_domain *rd = env->dst_rq->rd; int out_balance = 1; @@ -9974,17 +9984,6 @@ static struct sched_group *find_busiest_group(struct lb_env *env) goto out_balanced; } - local = &sds.local_stat; - busiest = &sds.busiest_stat; - - /* There is no busy sibling group to pull tasks from */ - if (!sds.busiest) - goto out_balanced; - - /* Misfit tasks should be dealt with regardless of the avg load */ - if (busiest->group_type == group_misfit_task) - goto force_balance; - /* ASYM feature bypasses nice load balance check */ if (busiest->group_type == group_asym_packing) goto force_balance; @@ -9997,6 +9996,8 @@ static struct sched_group *find_busiest_group(struct lb_env *env) if (busiest->group_type == group_imbalanced) goto force_balance; + local = &sds.local_stat; + /* * If the local group is busier than the selected busiest group * don't try and pull any tasks.