Re: [PATCH v2] sched/topology: Balance cluster static-key updates

From: Hui Su

Date: Thu Oct 22 2026 - 00:12:40 EST


> We should be able to combine with rcu_read_lock/unlock() and cpu_map walk
> for cpu_attach_domain(NULL, &def_root_domain, i) below.
> So we do the rcu and cpu_map walk operation once in this function
> instead of doing it twice.
>
> Moving the dec after the detach loop should be safe. It only say
> that a cluster domain exists, and cluster code that will still test
> for actual SD_CLUSTER domain flag on the relevant domain.
>
> I will also suggest that this fix be backported to the stable kernels
> (cc stable@xxxxxxxxxxxxxxx).

Hi Tim,

Agreed. Combining the cluster check with the existing detach loop avoids
the extra CPU mask walk and RCU read-side section.

I'll make this change in v3, move the static-key decrement after the
detach loop, and add Cc: stable@xxxxxxxxxxxxxxx as suggested.

Thanks for the review!

Hui