Re: [PATCH v5 2/2] sched/fair: Check a task has a fitting cpu when updating misfit

From: Qais Yousef
Date: Tue Feb 20 2024 - 11:16:07 EST


On 02/20/24 15:59, Qais Yousef wrote:

> I realized that I wanted to also add a new patch to not double balance_interval
> for misfit failures. I think you indicated that seems the right thing to do?

I think this should do it?

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 70ffbb1aa15c..b12b7de495d0 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -11552,8 +11552,13 @@ static int load_balance(int this_cpu, struct rq *this_rq,
* repeatedly reach this code, which would lead to balance_interval
* skyrocketing in a short amount of time. Skip the balance_interval
* increase logic to avoid that.
+ *
+ * Similarly misfit migration which is not necessarily an indication of
+ * the system being busy and requires lb to backoff to let it settle
+ * down.
*/
- if (env.idle == CPU_NEWLY_IDLE)
+ if (env.idle == CPU_NEWLY_IDLE ||
+ env.migration_type == migrate_misfit)
goto out;

/* tune up the balancing interval */