[RFC][PATCH] powerpc: respect how command line nr_cpus is set
Benjamin Herrenschmidt
benh at kernel.crashing.org
Thu May 5 12:25:02 EST 2011
On Wed, 2011-05-04 at 15:17 -0500, Kumar Gala wrote:
> We should utilize nr_cpus as the max # of CPUs that we can have present
> instead of NR_CPUS. This way we actually respect how nr_cpus is set on
> the command line rather than ignoring it.
>
> Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
> ---
> I think this is what we should be doing, but would like someone else to take
> a look.
The main question I have is should max_cpus absolutely limit the number
of possible CPUs or should it limit the number that get automatically
onlined at boot, potentially letting us bring the rest online later on ?
Cheers,
Ben.
> - k
>
> arch/powerpc/kernel/setup-common.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
> index 21f30cb..fedf813 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -424,7 +424,7 @@ void __init smp_setup_cpu_maps(void)
>
> DBG("smp_setup_cpu_maps()\n");
>
> - while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) {
> + while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < nr_cpu_ids) {
> const int *intserv;
> int j, len;
>
> @@ -443,7 +443,7 @@ void __init smp_setup_cpu_maps(void)
> intserv = &cpu; /* assume logical == phys */
> }
>
> - for (j = 0; j < nthreads && cpu < NR_CPUS; j++) {
> + for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
> DBG(" thread %d -> cpu %d (hard id %d)\n",
> j, cpu, intserv[j]);
> set_cpu_present(cpu, true);
> @@ -483,12 +483,12 @@ void __init smp_setup_cpu_maps(void)
> if (cpu_has_feature(CPU_FTR_SMT))
> maxcpus *= nthreads;
>
> - if (maxcpus > NR_CPUS) {
> + if (maxcpus > nr_cpu_ids) {
> printk(KERN_WARNING
> "Partition configured for %d cpus, "
> "operating system maximum is %d.\n",
> - maxcpus, NR_CPUS);
> - maxcpus = NR_CPUS;
> + maxcpus, nr_cpu_ids);
> + maxcpus = nr_cpu_ids;
> } else
> printk(KERN_INFO "Partition configured for %d cpus.\n",
> maxcpus);
More information about the Linuxppc-dev
mailing list