Messages in this thread | | | Date | Sun, 14 Apr 2024 09:31:08 -0700 | From | Saurabh Singh Sengar <> | Subject | Re: [PATCH] x86/Kconfig: Allow NR_CPUS between 512 and 8192 |
| |
On Mon, Mar 04, 2024 at 08:13:23AM -0800, Saurabh Singh Sengar wrote: > On Tue, Feb 20, 2024 at 01:50:13AM -0800, Saurabh Sengar wrote: > > Today there is no way one can choose any value between 512 to 8192 > > for NR_CPUS seamlessly. NR_CPUS is guarded by NR_CPUS_RANGE_END which > > is further dependent on CPUMASK_OFFSTACK to allow NR_CPUs > 512. > > > > For x86, CPUMASK_OFFSTACK can only be enabled either by selecting MAXSMP > > or DEBUG_PER_CPU_MAPS. Both of these options has a cost to pay. MAXSMP > > will increase the NR_CPUS to 8192 which will have impact on kernel image > > size whereas DEBUG_PER_CPU_MAPS will have additional run time overheads. > > Thus there is no good way to have NR_CPUS anything between 512 to 8192. > > > > Fix this by selecting CPUMASK_OFFSTACK if NR_CPUS > 512 and > > let NR_CPUS_RANGE_END set to 8192. > > > > On a Hyper-V system where max number of CPUs are only 2048, this > > patch saves around 1 MB of kernel image size, compare to MAXSMP. > > > > Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com> > > --- > > > > I want to mention that in ARM and other archs its very simple > > to select any value for NR_CPUS. This is an attempt to have more > > flexibilty in x86 arch as well to choose NR_CPUS. > > > > Some of the earlier discussions reated to it which could be of interest: > > https://lore.kernel.org/lkml/1708092603-14504-1-git-send-email-ssengar@linux.microsoft.com/ > > https://lore.kernel.org/lkml/794a1211-630b-3ee5-55a3-c06f10df1490@linux.com/ > > > > Another approach I can think of is to allow CPUMASK_OFFSTACK to be enabled > > more freely like the below patch of Libo Chen, that will also solve the > > problem I am addressing. But I feel this patch may have impact on other > > archs as well and I am not sure if that is in best interest of all the archs. > > > > https://lore.kernel.org/lkml/20220412231508.32629-2-libo.chen@oracle.com/ > > > > arch/x86/Kconfig | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > index 07a0c8d4e9c7..458f3f250d7f 100644 > > --- a/arch/x86/Kconfig > > +++ b/arch/x86/Kconfig > > @@ -34,6 +34,7 @@ config X86_64 > > select SWIOTLB > > select ARCH_HAS_ELFCORE_COMPAT > > select ZONE_DMA32 > > + select CPUMASK_OFFSTACK if NR_CPUS > 512 > > > > config FORCE_DYNAMIC_FTRACE > > def_bool y > > @@ -1006,8 +1007,7 @@ config NR_CPUS_RANGE_END > > config NR_CPUS_RANGE_END > > int > > depends on X86_64 > > - default 8192 if SMP && CPUMASK_OFFSTACK > > - default 512 if SMP && !CPUMASK_OFFSTACK > > + default 8192 if SMP > > default 1 if !SMP > > > > config NR_CPUS_DEFAULT > > > > -- > > 2.34.1 > > > > x86 Maintainers, > > Kind reminder to have your feedback on this patch. > > - Saurabh > ping
| |