mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ameen <ameenali023@gmail.com>
To: mingo@kernel.org, peterz@infradead.org, mhocko@suse.com, vbabka@suse.cz
Cc: linux-kernel@vger.kernel.org, Ameen <AmeenAli023@gmail.com>
Subject: [PATCH 2/2] Use num_possible_cpus() instead of direct use of NR_CPUS.
Date: Sun, 10 Jan 2016 17:13:25 +0200	[thread overview]
Message-ID: <1452438805-3205-1-git-send-email-AmeenAli023@gmail.com> (raw)

WARNING: usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus()..

Signed-off-by : Ameen Ali <Ameenali023@gmail.com>
---
 kernel/smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index d903c02..94033ac 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -549,13 +549,13 @@ static int __init maxcpus(char *str)
 early_param("maxcpus", maxcpus);
 
 /* Setup number of possible processor ids */
-int nr_cpu_ids __read_mostly = NR_CPUS;
+int nr_cpu_ids __read_mostly = num_possible_cpus();
 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;
+	nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),num_possible_cpus()) + 1;
 }
 
 void __weak smp_announce(void)
-- 
2.5.0

             reply	other threads:[~2016-01-10 15:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-10 15:13 Ameen [this message]
2016-01-11 13:46 ` Vlastimil Babka
2016-01-11 22:14   ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452438805-3205-1-git-send-email-AmeenAli023@gmail.com \
    --to=ameenali023@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®