]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched/cache: Fix has_multi_llcs iff at least one partition has multiple LLCs
authorChen Yu <yu.c.chen@intel.com>
Wed, 13 May 2026 20:39:25 +0000 (13:39 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 18 May 2026 19:33:18 +0000 (21:33 +0200)
commita7660ce1590fc1316a44cc2af53a07a21dfc25da
treefc4de0f8c66c54cb1e0f16ad7d23a1144ff86222
parent5beff4f087277901444787d4b7af6b3a93c34c54
sched/cache: Fix has_multi_llcs iff at least one partition has multiple LLCs

sched_cache_present is a global static key, but build_sched_domains()
is called per partition from the "Build new domains" loop in
partition_sched_domains_locked(). Each call unconditionally sets the
key based solely on the has_multi_llcs local variable for that partition.

The call to the last partition set the value even when there
are previous partitions with multiple LLCs.

If partition A (multi-LLC) is built first, the key is enabled. Then
when partition B (single-LLC) is built, the key is disabled. The
multi-LLC partition A is still active but the key is now off.

Fix it by doing a similar thing as sched_energy_present: check the
multi-LLCs during the iteration over all the partitions rather than
checking it on a single partition.

This bug was reported by sashiko.

Fixes: d59f4fd1d303 ("sched/cache: Enable cache aware scheduling for multi LLCs NUMA node")
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Co-developed-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/c541af2547d54509fbfd3b3a1e8072e2e5c7ff68.1778703694.git.tim.c.chen@linux.intel.com
kernel/sched/topology.c