Re: [PATCH] cpu: memoise number of possible cpus

From: Andrew Morton
Date: Thu Apr 18 2024 - 16:26:07 EST


On Thu, 18 Apr 2024 07:19:27 +0300 Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:

> cpu_possible_mask is fixed after boot, so it makes sense
> to calculate number of possible cpus to
> a) make num_possible_cpus() faster (distros ship with _large_ NR_CPUS),
> b) unscrew codegen elsewhere replacing function call
> with simple memory load.

There are a lot of calls to set_cpu_possible(). Perhaps calculating
num_possible_cpus within there would reduce risk of things getting out
of sync, either now or in the future.

reset_cpu_possible_mask() appears to have no callers. Kill?