Re: [PATCH] arm64: Kconfig: Don't select CPUMASK_OFFSTACK with 64K pages

From: Will Deacon

Date: Fri Nov 27 2026 - 13:43:23 EST


On Fri, Oct 30, 2026 at 06:50:18AM -0700, Breno Leitao wrote:
> On Fri, Oct 30, 2026 at 11:53:56AM +0000, Will Deacon wrote:
> > Because you might have thousands of CPUs?
>
> I checked that case. I built defconfig with 64K pages and NR_CPUS=4096,
> with and without this patch, and compared clang's -fstack-usage output.
>
> With the patch, 62 functions grow by 512 bytes or more. The worst are in
> cpuset: update_prstate(), cpuset_write_resmask() and
> cpuset_handle_hotplug() grow by ~1.5K, to 1648 bytes. Nothing crosses
> FRAME_WARN, and the largest frame in the build goes from 1312 to 1648
> bytes, out of a 64K stack.
>
> I believe this higher frame usage is still way better than the kmalloc
> at function invocation (the reason for this patch), but honestly I don't
> have real numbers, and I am happy to take them, if it is worth.
>
> > Because copying these things by value could be expensive?
>
> Hmm, I _think_ having the cpumask on the stack or not doesn't change how
> it is passed. cpumask_var_t is either a pointer or a one-element array,
> which decays to a pointer, so callees get a struct cpumask * in both
> cases.
>
> Which copies do you have in mind?

Fair enough, I hadn't looked too closely into that. But the fundamental
observation remains that the page size and the number of CPUs are
unrelated.

Will