JDK-8147905 : Verify all uses of os::processor_count()
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Not an Issue
  • Submitted: 2016-01-21
  • Updated: 2016-07-25
  • Resolved: 2016-07-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8147906 :  
JDK-8147907 :  
JDK-8147908 :  
JDK-8149331 :  
Description
os::processor_count() is set to the number of logical processors configured on a system (exact definition varies by platform). With the use of CPU sets, resource pools,  and other affinity based mechanisms this can be a much larger value than the number of CPUs available for the VM to use.

The number of CPUs currently available for the VM to use should be reported through os::active_processor_count(). Though its use in this role has evolved over time - on *NIX platforms there has tyically been no difference between the active_processor_count and processor_count.

Windows and Solaris both account (to varying degrees) for a reduced number of processors being available to the VM, as reported by the active_processor_count, due to explicit scheduling affinity changes to the process, or the use of cpu/processor sets.

With the fix for 6515172 Linux will also account for the use of CPU sets in the value reported from active_processor_count.

Given the difference between the "configured" and "active" processor counts we need to ensure that different subsystems in the VM are using the right API in making any decisions based on "number of processors". Hence this task.

I will create sub-tasks for each area where processor_count() is being used (other than use in os::active_processor_count()) so that we can verify that use is correct, or else change it. 

runtime will own this umbrella task but I will assign subtasks based on the actual area of affected code.
Comments
All uses have been verified and appropriate action taken where needed. Any remaining issues are being handled stand-alone.
25-07-2016

I was not aware of JDK-8078703 when I created the G1 sub-tasks for this umbrella CR. One of them can be closed.
20-04-2016

JDK-8078703 seems related to this CR.
20-04-2016

The AIX use in os::pd_print_cpu_info is correct.
21-01-2016

The uses in os::print_cpu_info() and os::print_summary_info() are correct.
21-01-2016