* [PATCH] x86: Put the num_processors++ code in a more suitable position
@ 2016-09-06 5:31 Dou Liyang
2016-09-06 21:23 ` David Rientjes
0 siblings, 1 reply; 3+ messages in thread
From: Dou Liyang @ 2016-09-06 5:31 UTC (permalink / raw)
To: linux-kernel; +Cc: x86, tglx, mingo, hpa, Dou Liyang
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 <douly.fnst@cn.fujitsu.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: Put the num_processors++ code in a more suitable position
2016-09-06 5:31 [PATCH] x86: Put the num_processors++ code in a more suitable position Dou Liyang
@ 2016-09-06 21:23 ` David Rientjes
2016-09-07 2:07 ` Dou Liyang
0 siblings, 1 reply; 3+ messages in thread
From: David Rientjes @ 2016-09-06 21:23 UTC (permalink / raw)
To: Dou Liyang; +Cc: linux-kernel, x86, tglx, mingo, hpa
On Tue, 6 Sep 2016, Dou Liyang wrote:
> This is a code optimization.
>
Not sure that it's optimization, it's just for correctness.
> 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 <douly.fnst@cn.fujitsu.com>
Acked-by: David Rientjes <rientjes@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: Put the num_processors++ code in a more suitable position
2016-09-06 21:23 ` David Rientjes
@ 2016-09-07 2:07 ` Dou Liyang
0 siblings, 0 replies; 3+ messages in thread
From: Dou Liyang @ 2016-09-07 2:07 UTC (permalink / raw)
To: David Rientjes; +Cc: linux-kernel, x86, tglx, mingo, hpa
Hi David,
At 09/07/2016 05:23 AM, David Rientjes wrote:
> On Tue, 6 Sep 2016, Dou Liyang wrote:
>
>> This is a code optimization.
>>
>
> Not sure that it's optimization, it's just for correctness.
Yes, I see. I will improve it in next version.
Thanks,
Dou
>
>> 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 <douly.fnst@cn.fujitsu.com>
>
> Acked-by: David Rientjes <rientjes@google.com>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-07 2:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-06 5:31 [PATCH] x86: Put the num_processors++ code in a more suitable position Dou Liyang
2016-09-06 21:23 ` David Rientjes
2016-09-07 2:07 ` Dou Liyang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).