Re: [PATCH 05/19] sched/fair: Add LLC index mapping for CPUs

From: Peter Zijlstra

Date: Wed Oct 15 2025 - 07:08:46 EST


On Sat, Oct 11, 2025 at 11:24:42AM -0700, Tim Chen wrote:
> Introduce an index mapping between CPUs and their LLCs. This provides

"Introduce a *dense* mapping ...", since we already have a mapping, but
as you explain below, that is sparse and not well suited for indexing.

> a continuous per LLC index needed for cache-aware load balancing in
> later patches.

> The maximum number of LLCs is limited by CONFIG_NR_LLCS. If the number
> of LLCs available exceeds CONFIG_NR_LLCS, the cache aware load balance
> is disabled. To further save memory, this array could be converted to
> dynamic allocation in the future, or the LLC index could be made NUMA
> node-wide.


> +config NR_LLCS
> + int "Maximum number of Last Level Caches"
> + range 2 1024
> + depends on SMP && SCHED_CACHE
> + default 64
> + help
> + This allows you to specify the maximum number of last level caches
> + this kernel will support for cache aware scheduling.

Not really a fan of this max thing. I suppose I'll see the use in the
next few patches, but ideally we'd start with the dynamic solution.