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 <ga...@kernel.crashing.org>
---
I think this is what we should be doing, but would like someone else to take
a look.

- 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);
-- 
1.7.3.4

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to