smp: don't declare nr_cpu_ids if NR_CPUS == 1
authorYury Norov <yury.norov@gmail.com>
Mon, 5 Sep 2022 23:08:16 +0000 (16:08 -0700)
committerYury Norov <yury.norov@gmail.com>
Tue, 20 Sep 2022 00:51:53 +0000 (17:51 -0700)
SMP and NR_CPUS are independent options, hence nr_cpu_ids may be
declared even if NR_CPUS == 1, which is useless.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
kernel/smp.c

index 650810a..e971c96 100644 (file)
@@ -1088,9 +1088,11 @@ static int __init maxcpus(char *str)
 
 early_param("maxcpus", maxcpus);
 
+#if (NR_CPUS > 1)
 /* Setup number of possible processor ids */
 unsigned int nr_cpu_ids __read_mostly = NR_CPUS;
 EXPORT_SYMBOL(nr_cpu_ids);
+#endif
 
 /* An arch may set nr_cpu_ids earlier if needed, so this would be redundant */
 void __init setup_nr_cpu_ids(void)