Re: [PATCH] sched/topology: improve topology_span_sane speed

From: Peter Zijlstra
Date: Tue Oct 15 2024 - 07:06:08 EST


On Tue, Oct 15, 2024 at 03:50:49PM +0530, K Prateek Nayak wrote:

> > + masks = kmalloc_array(num_possible_cpus(), sizeof(struct cpumask *), GFP_KERNEL);
> > + if (!masks)
> > + return ret;
>
> That looks like a very large array that seems unnecessary. Instead, is
> it possible to use "tl->mask(id)" down blow to check for equality? (I'll
> elaborate more below)

drive-by comments, haven't got time atm to read this, but
num_possible_cpus() is wrong, this should be nr_cpu_ids.

The CPU mask must not be assumed dense.