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

From: Steve Wahl
Date: Tue Oct 15 2024 - 18:58:44 EST


On Tue, Oct 15, 2024 at 01:05:44PM +0200, Peter Zijlstra wrote:
> 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.

You're absolutly right, not sure how I did this, but Prateek's
suggestion will remove the array and needing to size it, so this
problem will be removed in the next iteration.

--> Steve

--
Steve Wahl, Hewlett Packard Enterprise