RFR: 6942632: Hotspot should be able to use more than 64 logical processors on Windows [v7]

Saint Wesonga duke at openjdk.org
Fri Mar 1 23:09:05 UTC 2024


> Windows processor groups support a maximum of 64 logical processors per processor group. OpenJDK currently uses the GetSystemInfo API to get the number of processors on the system. GetSystemInfo only returns the number of processors in the current processor group, which is at most 64. Therefore, OpenJDK needs to be updated to support the use of all available processors across all Windows processor groups. However, this should only be done when running on Windows 11 or Windows Server 2022 or later Windows operating systems.
> 
> Starting with Windows 11 and Windows Server 2022, applications are no longer constrained by default to a single processor group. Instead, processes and their threads have processor affinities that by default span all processors in the system, across multiple groups on machines with more than 64 processors. This is in contrast to previous operating system versions where the processor group affinity APIs needed to be used to assign each thread a specific processor group. See  https://learn.microsoft.com/en-us/windows/win32/procthread/processor-groups#behavior-starting-with-windows-11-and-windows-server-2022
> 
> The key changes required are:
> 
> 1. Detecting Windows 11 or Windows Server 2022 or later.
> 1. Using the The GetLogicalProcessorInformationEx function to correctly retrieve the total number of processors available on the system. This function was introduced in Windows 7 so its availability needs to be explicitly determined.
> 1. Updating the calculation of the number of active processors.
>     1. Processor affinities can be set in a Windows job object and if the JVM is launched in a job object, these affinities restrict the processors that the JVM can use (regardless of how many processors the system has).
>     1. The JVM can also be launched from the command prompt  by using the start command to set processor affinities instead of using a job object. This command only sets the processor affinity of the primary processor group because it is a 64-bit affinity mask. On systems with over 64 processors, passing an all 1s 64-bit affinity mask to the start command is treated as equivalent to no processor affinity restrictions for the JVM. Any other affinity mask passed to the start command explicitly sets the number of available processors for the JVM and is necessarily at most 63, even if the machine has more than 64 processors.
>     1. If no affinity restrictions are present, then all cores on the system will be available to the JVM.
> 
> References:
> ...

Saint Wesonga has updated the pull request incrementally with one additional commit since the last revision:

  Clean up warning messages

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/17576/files
  - new: https://git.openjdk.org/jdk/pull/17576/files/2db5d0a4..0eff42c9

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=17576&range=06
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17576&range=05-06

  Stats: 5 lines in 1 file changed: 0 ins; 4 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/17576.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17576/head:pull/17576

PR: https://git.openjdk.org/jdk/pull/17576


More information about the hotspot-runtime-dev mailing list