RFR: 6942632: Hotspot should be able to use more than 64 logical processors on Windows [v20]
David Holmes
dholmes at openjdk.org
Thu May 9 07:32:58 UTC 2024
On Thu, 2 May 2024 17:19:14 GMT, Saint Wesonga <duke at openjdk.org> wrote:
>> 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 sets the process group affinity of the new process to a single processor group (since the affinity mask is a 64-bit value). The affinity mask passed to the "start" command explicitly sets the number of available processors for the JVM and is necessarily at most 64, even if the machine has more than 64 processors.
>> 1. If no affinity restrictions are present (i.e. there is no job object in use and an affinity setting command was not used), then all cores on the system will be available to the JVM.
>>
>> ### Test Scenarios
>> This simple Java program can be use...
>
> Saint Wesonga has updated the pull request incrementally with four additional commits since the last revision:
>
> - Build exeGetProcessorInfo.c on Windows only
> - Add jtreg test for multiple processor group support
> - Delete bash-based test
> - Move tests to runtime/os/windows/
Test changes look good. Thanks. I will run this through our CI.
-------------
PR Review: https://git.openjdk.org/jdk/pull/17576#pullrequestreview-2047327778
More information about the hotspot-runtime-dev
mailing list