From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755119AbcIFFbl (ORCPT ); Tue, 6 Sep 2016 01:31:41 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:64670 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754852AbcIFFbj (ORCPT ); Tue, 6 Sep 2016 01:31:39 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="10646568" From: Dou Liyang To: CC: , , , , Dou Liyang Subject: [PATCH] x86: Put the num_processors++ code in a more suitable position Date: Tue, 6 Sep 2016 13:31:27 +0800 Message-ID: <1473139887-27587-1-git-send-email-douly.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.5.5 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: 9170E40366F4.AFF02 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a code optimization. If checking the topology package map of apicid and cpu is failure, it will stop generating the processor info for that apicid and the disabled_cpus will plus one. However, the num-processors has already been added one above. That may cause the number of processors incorrect. Just put the num_processors++ code in the more suitable position. it makes sure that the num-processors will not conflict with the disabled_cpus. Signed-off-by: Dou Liyang --- arch/x86/kernel/apic/apic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 50c95af..f3e9b2d 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -2093,7 +2093,6 @@ int generic_processor_info(int apicid, int version) return -EINVAL; } - num_processors++; if (apicid == boot_cpu_physical_apicid) { /* * x86_bios_cpu_apicid is required to have processors listed @@ -2116,10 +2115,13 @@ int generic_processor_info(int apicid, int version) pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n", thiscpu, apicid); + disabled_cpus++; return -ENOSPC; } + num_processors++; + /* * Validate version */ -- 2.5.5