summaryrefslogtreecommitdiff
path: root/kernel/smp.c
diff options
context:
space:
mode:
authorYury Norov <yury.norov@gmail.com>2022-09-05 16:08:17 -0700
committerYury Norov <yury.norov@gmail.com>2022-09-19 17:51:53 -0700
commit38bef8e57f2149acd2c910a98f57dd6291d2e0ec (patch)
treec4a62158f1967502fa801529406a5a04624048f2 /kernel/smp.c
parent53fc190cc6771c5494d782210334d4ebb50c7103 (diff)
smp: add set_nr_cpu_ids()
In preparation to support compile-time nr_cpu_ids, add a setter for the variable. This is a no-op for all arches. Signed-off-by: Yury Norov <yury.norov@gmail.com>
Diffstat (limited to 'kernel/smp.c')
-rw-r--r--kernel/smp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/smp.c b/kernel/smp.c
index e971c9626a1b..150310a0947a 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -1070,7 +1070,7 @@ static int __init nrcpus(char *str)
int nr_cpus;
if (get_option(&str, &nr_cpus) && nr_cpus > 0 && nr_cpus < nr_cpu_ids)
- nr_cpu_ids = nr_cpus;
+ set_nr_cpu_ids(nr_cpus);
return 0;
}
@@ -1097,7 +1097,7 @@ EXPORT_SYMBOL(nr_cpu_ids);
/* An arch may set nr_cpu_ids earlier if needed, so this would be redundant */
void __init setup_nr_cpu_ids(void)
{
- nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) + 1;
+ set_nr_cpu_ids(find_last_bit(cpumask_bits(cpu_possible_mask), NR_CPUS) + 1);
}
/* Called by boot processor to activate the rest. */