Re: [PATCH v3 04/21] sched/cache: Make LLC id continuous
From: Chen, Yu C
Date: Thu Feb 19 2026 - 06:26:38 EST
On 2/19/2026 7:21 AM, Tim Chen wrote:
On Wed, 2026-02-18 at 23:16 +0530, K Prateek Nayak wrote:
Hello Chenyu,
On 2/18/2026 8:52 PM, Chen, Yu C wrote:
[ ... ]
Pratek,
How about modifying the patch like the following, stealing
a lot of your code. Also added change to shrink max LLCs when
the LLC with max id lost its last CPU.
Thanks.
[ ... ]
+
+static void __sched_domains_free_llc_id(int cpu)
+{
+ int i, lid;
+
+ lockdep_assert_held(&sched_domains_mutex);
+
+ lid = per_cpu(sd_llc_id, cpu);
+ if (lid == -1)
+ return;
+
+ per_cpu(sd_llc_id, cpu) = -1;
+
+ for_each_online_cpu(i) {
One minor question: should we only iterate through
cpu_coregroup_mask(cpu) to check if any sibling CPU
within this LLC owns the llc_id? If there are no online
CPUs within this LLC, I assume we should release this
llc_id.
thanks,
Chenyu
+ /* An online CPU owns the llc_id. */
+ if (per_cpu(sd_llc_id, i) == lid)
+ return;
+ }
+
+ cpumask_clear_cpu(lid, sched_domains_llc_id_allocmask);