Re: [PATCH] sched/fair: Don't pick recent_used_cpu if target has no LLC domain

From: Keisuke Nishimura

Date: Tue Nov 24 2026 - 13:13:17 EST


Hello,

Thank you for the feedback.

select_idle_sibling() can return prev or recent_used_cpu if they are idle
and share the LLC with target. However, cpus_share_cache() returns true
for any two isolated CPUs because their sd_llc_id is never set and keeps
the initial value.

Are you sure that's because their sd_llc_id is never set and keeps the
initial value? Or it's because they are in the same llc_mask() and we
use the same sd_llc_id for all CPUs in the same llc_mask ?


In the patch, I meant CPUs isolated by the boot parameter isolcpus,
whose sd_llc_id keeps the initial value. But in the case of cgroup
isolation, the following statement

> their sd_llc_id is never set and keeps the initial value.

is not true, although the same problem occurs. I will change the description in v2.


Being able to set a dedicated sd_llc_id for isolated cpu seems the right option


That might be a cleaner fix, but I am afraid it would be a bigger change. The id may need to be updated whenever a CPU enters or leaves an isolated partition in cgroup? Since the id also seems to be used for other purposes, e.g. index of per-LLC arrays in cache-aware scheduling (llc_id), the change could affect more than this issue.

As checking sd_llc already covers both boot parameter(isolcpus) and cgroup's isolation, would it be okay to keep this fix in this function?


@@ -9175,10 +9175,13 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target)
asym_fits_cpu(task_util, util_min, util_max, target))
goto select_smt_priority;

+ /* NULL if target has no LLC domain, e.g. isolcpus */
+ sd = rcu_dereference_all(per_cpu(sd_llc, target));

if sd_lls is null, can't we return immediately as there is no shared llc ?


Yes. I will do early-return here in v2.

Best,
Keisuke