Re: [tip: sched/core] sched/topology: Compute sd_weight considering cpuset partitions

From: Chen, Yu C

Date: Sat Mar 21 2026 - 03:48:15 EST


On 3/21/2026 3:33 PM, Chen, Yu C wrote:
On 3/21/2026 11:36 AM, K Prateek Nayak wrote:
   sd->span_weight = cpumask_weight(sched_domain_span(sd));

which should have crashed too if we had a NULL pointer in the
cpumask range. So I'm at a loss. Maybe the pc points to a
different location in your build?


A wild guess, the major change is that we access sd->span, before
initializing  the sd structure with *sd = { ... }. The sd is allocated
via alloc_percpu() uninitialized, the span at the end of the sd structure
remain uninitialized. It is unclear how cpumask_weight(sd->span) might be
affected by this uninitialized state. Before this patch, after *sd = { ... }
is executed, the contents of  sd->span are explicitly set to 0, which might
be safer?


I replied too fast, please ignore above comments, the sd->span should have been
set via cpumask_and(sd_span, cpu_map, tl->mask(tl, cpu))