Re: [PATCH v3 04/21] sched/cache: Make LLC id continuous

From: K Prateek Nayak

Date: Thu Feb 19 2026 - 11:10:35 EST


Hello Chenyu,

On 2/19/2026 4:55 PM, Chen, Yu C wrote:
>> +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.

That should work too! I'm assuming the arch/ side
unlink happens before this in which case we can simply
check cpumask_empty(cpu_coregroup_mask(cpu)).

>
> 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);
>

--
Thanks and Regards,
Prateek