From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759658AbcAKNq2 (ORCPT ); Mon, 11 Jan 2016 08:46:28 -0500 Received: from mx2.suse.de ([195.135.220.15]:54189 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759107AbcAKNq1 (ORCPT ); Mon, 11 Jan 2016 08:46:27 -0500 Subject: Re: [PATCH 2/2] Use num_possible_cpus() instead of direct use of NR_CPUS. To: Ameen , mingo@kernel.org, peterz@infradead.org, mhocko@suse.com References: <1452438805-3205-1-git-send-email-AmeenAli023@gmail.com> Cc: linux-kernel@vger.kernel.org From: Vlastimil Babka Message-ID: <5693B22E.3070409@suse.cz> Date: Mon, 11 Jan 2016 14:46:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1452438805-3205-1-git-send-email-AmeenAli023@gmail.com> Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/10/2016 04:13 PM, Ameen wrote: > WARNING: usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus().. Is that a checkpatch warning? Notice the word "often". You need to provide info why it's the case here (and I doubt the change will be corect in this case). > Signed-off-by : Ameen Ali > --- > 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) >