Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8326890

Hotspot should be able to use more than 64 logical processors on Windows

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 23
    • hotspot
    • None
    • behavioral
    • minimal
    • Hide
      A new flag is added to allow users to opt-in to the available behaviour. This avoids any unexpected changes to applications in terms of the number of available processors.

      However, the changes also take into account the use of a JobObject to control the processes resources, when determining the number of available processors. This is new behaviour but it seems unlikely that JobObjects would be used with Java applications when the JVM was not taking them into consideration.
      Show
      A new flag is added to allow users to opt-in to the available behaviour. This avoids any unexpected changes to applications in terms of the number of available processors. However, the changes also take into account the use of a JobObject to control the processes resources, when determining the number of available processors. This is new behaviour but it seems unlikely that JobObjects would be used with Java applications when the JVM was not taking them into consideration.
    • add/remove/modify command line option
    • JDK

      Summary

      Enable hotspot to use processors across all Windows processor groups on Windows 11/Windows Server 2022 and later.

      Problem

      Windows processor groups support a maximum of 64 logical processors per processor group. OpenJDK currently uses the GetSystemInfo API to determine the number of processors on a Windows machine. However, GetSystemInfo only returns the number of processors in the current processor group, which is at most 64. Therefore, OpenJDK cannot currently use over 64 processors on Windows.

      Solution

      Replace the GetSystemInfo API with the GetActiveProcessorCount API to correctly retrieve the total number of processors available on the system and add a new Windows-specific product flag, UseAllWindowsProcessorGroups to enable this functionality. The calculation of the number of active processors also needs to be updated to reflect the fact that the number of active processors can be restricted by a job object or suggested by the process affinity mask set for the OpenJDK process when it is launched using the "start" command in the Windows command prompt. Enabling the use of all available processors will only be done on Windows 11 and Windows Server 2022 and later since they automatically schedule threads across all processor groups without requiring applications to use the processor group affinity APIs.

      Specification

      This capability will be enabled by setting -XX:+UseAllWindowsProcessorGroups. This flag will be off by default to ensure that the JVM's calculation of the number of processors available does not change unless the user enables this product flag. There are 3 scenarios for launching the JVM on these modern Windows versions:

      1. Launching the java process directly, e.g. by running java.exe <arguments> on the command line: in this case, the product flag is off by default and the JVM will behave the same as in previous releases (at most 64 processors available). If the product flag is enabled via java.exe -XX:+UseAllWindowsProcessorGroups then all processors will be available to the JVM.

      2. Launching the java process using the "start" command with a custom 64-bit processor affinity: the number of available processors will match the number of processors enabled in the specified affinity mask. For example, start /affinity ef12 java.exe <arguments> will result in 9 available processors (hex ef12 is binary 1110111100010010 - so 9 enabled processors)..

      3. Launching the java process in a Windows job. Job objects can specify custom processor affinities. The affinities in the job object will be used to compute the number of processors available (the sum of set bits in the masks).

      On older Windows versions (i.e. those that do not automatically schedule threads across all processor groups), this warning will be issued if the product flag is enabled:

      The UseAllWindowsProcessorGroups flag is not supported on this Windows version and will be ignored.

      If the JVM is launched in a job object that enables processors across multiple groups, this warning will be displayed on older Windows versions:

      The Windows job object has enabled multiple processor groups (%d) but only 1 is supported on this Windows version. Some processors might not be used.

      On Windows versions that automatically schedule across all processor groups, the use of multiple processor groups in a job object will result in this warning if the product flag is off:

      The Windows job object has enabled multiple processor groups (%d) but the UseAllWindowsProcessorGroups flag is off. Some processors might not be used.

      For implementation details, see https://github.com/openjdk/jdk/pull/17576

            swesonga Saint Wesonga
            phh Paul Hohensee
            David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: