8058935: CPU detection gives 0 cores per cpu, 2 threads per core in Amazon EC2 environment
authorvkempik
Mon, 01 Dec 2014 18:22:45 +0400
changeset 27881 031beca6c682
parent 27880 afb974a04396
child 27882 ceece07bef14
8058935: CPU detection gives 0 cores per cpu, 2 threads per core in Amazon EC2 environment Reviewed-by: kvn, dsamersoff
hotspot/src/cpu/x86/vm/vm_version_x86.hpp
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Mon Dec 01 12:16:15 2014 -0500
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Mon Dec 01 18:22:45 2014 +0400
@@ -570,10 +570,12 @@
   static uint cores_per_cpu()  {
     uint result = 1;
     if (is_intel()) {
-      if (supports_processor_topology()) {
+      bool supports_topology = supports_processor_topology();
+      if (supports_topology) {
         result = _cpuid_info.tpl_cpuidB1_ebx.bits.logical_cpus /
                  _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
-      } else {
+      }
+      if (!supports_topology || result == 0) {
         result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1);
       }
     } else if (is_amd()) {