sched/cache: Ignore non-fair current in alb_break_llc()
PATCH v2 1/1 sched/cache: Ignore non-fair current in alb_break_llc()
Commit d6b9afab44e23 ("sched/cache: Fix
checking active load balance by only considering the CFS task") stopped using task_util() for non-fair cur.
__active_load_balance_cpu_stop() calls detach_one_task(), that only looks to cfs_tasks list. So if the rq->curr is not fair, doing a decision according to it is wrong, since we only migrate tasks that is fair.
Commit f0d243a96f26 ("sched/fair: Avoid creating misfits during cache-aware balancing") passes cur to task_misfits_asym_cpu() without checking if the cur is in fair class or not. Fix this.
---
Changes v1->v2:
* Add suggested comment (Tim Chen :>)
* Change the changelog so that it says the issue is passing a non-fair cur to task_misfits_asym_cpu()
This versions not compile-tested. Tho only change is this comment, so it should be fine. Right? ;-).
kernel/sched/fair.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
kernel/sched/fair.c +8 -1
@@ -11016,7 +11016,14 @@ alb_break_llc(struct lb_env *env)return true; cur =rcu_dereference_all (env->src_rq->curr); -if (cur && cur->sched_class == &fair_sched_class) +/* +* Active balance only detaches CFS tasks, so a non-fair +* curr is never migrated. Ignore it and avoid using its +* stale util in the misfit and LLC checks. +*/ +if (cur && cur->sched_class != &fair_sched_class) + cur =NULL ; +if (cur) util =task_util (cur); if (task_misfits_asym_cpu(env, cur) ||
Signature · 1 line
2.53.0
Quoted 11 lines · Kayra Cizmeci
Commit
d6b9afab44e23("sched/cache: Fix
checking active load balance by only considering the CFS task") stopped usingtask_util()for non-fair cur.
__active_load_balance_cpu_stop()callsdetach_one_task(), that only looks tocfs_taskslist. So if therq->curris not fair, doing a decision according to it is wrong, since we only migrate tasks that is fair.Commit
f0d243a96f26("sched/fair: Avoid creating misfits during cache-aware balancing") passes cur totask_misfits_asym_cpu()without checking if the cur is in fair class or not. Fix this.
Sent out a suggested update to the commit log of v1 before I saw v2.
This updated log and patch looks okay to me.
Tim
Quoted 35 lines
Fixes f0d243a96f26 ("sched/fair: Avoid creating misfits during cache-aware balancing")Signed-off-by Kayra Cizmeci <[email protected]>---
Changesv1->v2:
* Add suggested comment (Tim Chen :>)
* Change the changelog so that it says the issue is passing a non-fair cur totask_misfits_asym_cpu()This versions not compile-tested. Tho only change is this comment, so it should be fine. Right? ;-).
kernel/sched/fair.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)kernel/sched/fair.c +8
-1@@ -11016,7 +11016,14 @@ alb_break_llc(struct lb_env *env)return true; cur =rcu_dereference_all (env->src_rq->curr); -if (cur && cur->sched_class == &fair_sched_class) +/* +* Active balance only detaches CFS tasks, so a non-fair +* curr is never migrated. Ignore it and avoid using its +* stale util in the misfit and LLC checks. +*/ +if (cur && cur->sched_class != &fair_sched_class) + cur =NULL ; +if (cur) util =task_util (cur); if (task_misfits_asym_cpu(env, cur) ||
The following commit has been merged into the sched/urgent branch of tip:
The following commit has been merged into the sched/urgent branch of tip:
Commit-ID: 006991aa89974378ee579416dba87adc22cd60fd Gitweb: https://git.kernel.org/tip/006991aa89974378ee579416dba87adc22cd60fd Author: Kayra Cizmeci <[email protected]> AuthorDate: Tue, 20 Oct 2026 21:54:01 +03:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 06 Nov 2026 10:10:52 +01:00
sched/cache: Ignore non-fair current in alb_break_llc()
Commit d6b9afab44e23 ("sched/cache: Fix
checking active load balance by only considering the CFS task") stopped using task_util() for non-fair cur.
__active_load_balance_cpu_stop() calls detach_one_task(), that only looks to cfs_tasks list. So if the rq->curr is not fair, doing a decision according to it is wrong, since we only migrate tasks that is fair.
Commit f0d243a96f26 ("sched/fair: Avoid creating misfits during cache-aware balancing") passes cur to task_misfits_asym_cpu() without checking if the cur is in fair class or not. Fix this.
--- kernel/sched/fair.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
kernel/sched/fair.c +8 -1
@@ -11029,7 +11029,14 @@ alb_break_llc(struct lb_env *env)return true; cur =rcu_dereference_all (env->src_rq->curr); -if (cur && cur->sched_class == &fair_sched_class) +/* +* Active balance only detaches CFS tasks, so a non-fair +* curr is never migrated. Ignore it and avoid using its +* state util in the misfit and LLC checks. +*/ +if (cur && cur->sched_class != &fair_sched_class) + cur =NULL ; +if (cur) util =task_util (cur); if (task_misfits_asym_cpu(env, cur) ||