Re: [PATCH] sched/topology: Assert non-NUMA topology masks don't (partially) overlap

From: Valentin Schneider
Date: Thu Jan 16 2020 - 10:30:59 EST




On 16/01/2020 15:19, Peter Zijlstra wrote:
> On Thu, Jan 16, 2020 at 11:44:28AM +0100, Peter Zijlstra wrote:
>> On Wed, Jan 15, 2020 at 04:09:15PM +0000, Valentin Schneider wrote:
>>> @@ -1975,6 +2011,9 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
>>> has_asym = true;
>>> }
>>>
>>> + if (WARN_ON(!topology_span_sane(tl, cpu_map, i)))
>>> + goto error;
>>> +
>>> sd = build_sched_domain(tl, cpu_map, attr, sd, dflags, i);
>>>
>>> if (tl == sched_domain_topology)
>>
>> This is O(nr_cpus), but then, that function already is, so I don't see a
>> problem with this.
>
> Clearly I meant to write O(nr_cpus^2), there's a bunch of nested
> for_each_cpu() in there.
>

Hm so the sanity check is O(topo_levels * nr_cpusÂ), and I think that
roughly matches the complexity of building the sched_groups (I say
roughly because you go over less CPUs as you go up the topo levels).

As you said the important bit is that we don't make build_sched_domains()
noticeably worse, which I think is the case...

>> I'll take it, thanks!