Re: [PATCH] sched/cache: Fix a thread aggregation conflict when there is one runnable task
From: Zhan Xusheng
Date: Mon Jul 27 2026 - 02:41:25 EST
On Mon, Jul 27, 2026 at 09:29:14AM +0800, Chen Yu wrote:
> - if (sched_asym(env->sd, i, env->dst_cpu) && nr_running == 1)
> + if (sched_asym(env->sd, i, env->dst_cpu) && nr_running == 1 &&
> + env->migration_type != migrate_llc_task)
> continue;
The fix looks correct for the ITMT case. I also convinced myself it does
not introduce a migrate_llc_task <-> asym-packing ping-pong: once the task
lands in its preferred LLC, a subsequent asym pull-back is a migrate_task,
which goes through can_migrate_task() -> migrate_degrades_llc() ->
can_migrate_llc_task() == mig_forbid (moving away from the preferred LLC),
so it returns 0 and the task is not pulled back (modulo the
nr_balance_failed >= cache_nice_tries + 1 escape). So it should not
oscillate. Nice.
One minor consistency question: the adjacent single-task filter just above,
if (env->sd->flags & SD_ASYM_CPUCAPACITY &&
!capacity_greater(capacity_of(env->dst_cpu), capacity) &&
nr_running == 1)
continue;
has the same nr_running == 1 shape and is not exempted for
migrate_llc_task. I don't think it is reachable on current hardware (it
would need both multiple LLCs, so migrate_llc_task can fire, and
asymmetric CPU capacity at that domain), so this is not a correctness
concern for the reported case. But since the two filters now treat
migrate_llc_task differently, was leaving the capacity one intentional
(capacity prioritized over cache locality on asym-capacity), or just out
of scope here? A word in the changelog would make the intent clear.
Thanks,
Xusheng