Re: [PATCH 2/5] sched/fair: Attach sched_domain_shared to sd_asym_cpucapacity

K Prateek Nayak
2026-05-06T10:20:05Z

Hello Vincent,

On 5/6/2026 3:15 PM, Vincent Guittot wrote:
>> @@ -7925,7 +7925,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, bool
>> struct cpumask *cpus = this_cpu_cpumask_var_ptr(select_rq_mask);
>> int i, cpu, idle_cpu = -1, nr = INT_MAX;
>>
>> - if (sched_feat(SIS_UTIL)) {
>> + if (sched_feat(SIS_UTIL) && sd->shared) {
>
> If shared is attached to sd_asym_cpucapacity instead of sd_llc we
> should never reach this point. Or I'm missing a case ?

So the hotpulg might race with a wakeup like:

claim_asym_sched_domain_shared()
init_sched_domain_shared(d, sd_asym);
return true;
update_top_cache_domain()
rcu_assign_pointer(sd_llc, sd);
... select_idle_sibling()
sd = rcu_dereference_all(sd_asym_cpucapacity)
/* sd_asym_cpucapacity still hasn't been updated */
if (sd /* NULL */) { ... }
sd = rcu_dereference_all(sd_llc); /* Valid */
select_idle_cpu(sd)
rcu_assign_pointer(sd_asym_cpucapacity, sd); sd->shared /* NULL */

This prevents that rare race where a remote CPU will see sd_llc
before sd_asym is published and take the !ASYM wakeup route only
to find sd->shared is NULL since sd_asym has claimed it.

>
>> /*
>> * Increment because !--nr is the condition to stop scan.
>> *

--
Thanks and Regards,
Prateek