RFR: 8338136: Hotspot should support multiple large page sizes on Windows [v2]
Daniel Jeliński
djelinski at openjdk.org
Tue Oct 1 09:38:43 UTC 2024
On Tue, 10 Sep 2024 17:12:38 GMT, Dhamoder Nalla <dhanalla at openjdk.org> wrote:
>> This pull request introduces enhancements to the handling of large page sizes in the OpenJDK for Windows systems, aiming to align its capabilities with those observed on Linux platforms. Investigation through SPECJBB benchmarks across various platforms revealed a 16-year-old limitation in handling large pages over 4MB for IA32/AMD64 architectures, with no such constraints for Windows on ARM64.
>>
>> JBS issue https://bugs.openjdk.org/browse/JDK-8338136
>>
>> The goal of this change is to overcome the 4MB large page size limitation, thereby enhancing Windows' large page support to match Linux's more flexible handling capabilities. This decision to remove 4MB constraint was influenced by insights from Linux's implementation strategies. The implementation supports multiple large page sizes , specifically excluding the IA32 architecture.
>>
>> Key changes and bug fixes include enabling Windows support for multiple huge page sizes with -XX:LargePageSizeInBytes, and utilizing logic from [JDK-8271195](https://bugs.openjdk.org/browse/JDK-8271195) to use the largest available large page size smaller than LargePageSizeInBytes when available.
>>
>> This update removes the 4MB limit on AMD64 for Windows, populating the shared array to enable fallback options on all architectures except IA32. The implementation introduces an experimental flag, defaulting to FALSE, to facilitate testing and gradual adoption of these changes. The flag allows users to opt-in to the new large page handling logic, with a warning mechanism implemented for cases where the requested large page size is not a multiple of the OS minimum page size.
>
> Dhamoder Nalla has updated the pull request incrementally with one additional commit since the last revision:
>
> Make JVM flag EnableAllLargePageSizesForWindows non-experimental
I'm not familiar with JVM's memory handling, so just a few general observations...
src/hotspot/os/windows/os_windows.cpp line 3328:
> 3326: }
> 3327: #if defined(IA32)
> 3328: if (size > 4 * M || LargePageSizeInBytes > 4 * M) {
Please fix the indentation
src/hotspot/os/windows/os_windows.cpp line 3347:
> 3345: }
> 3346: } else {
> 3347: WARN("The JVM cannot use large pages because the large page size setting is not configured, defaulting to minimum page size (%d).", size);
This message looks wrong; LargePageSizeInBytes=0 is documented to use the default large page size, and it seems that the surrounding code does just that. Is the warning even necessary?
src/hotspot/os/windows/os_windows.cpp line 3368:
> 3366:
> 3367: // Populate _page_sizes with large page sizes less than or equal to _large_page_size, ensuring each page size is double the size of the previous one.
> 3368: for (size_t page_size = min_size; page_size < _large_page_size; page_size *= 2) {
Does Windows actually use these page sizes, or does it always use 2M pages?
Also, you're only adding powers of 2 here; the user-defined LargePageSizeInBytes doesn't need to be a power of two, and can be 6MB, for example. Will that be a problem?
-------------
PR Review: https://git.openjdk.org/jdk/pull/20758#pullrequestreview-2339623525
PR Review Comment: https://git.openjdk.org/jdk/pull/20758#discussion_r1782433744
PR Review Comment: https://git.openjdk.org/jdk/pull/20758#discussion_r1782425476
PR Review Comment: https://git.openjdk.org/jdk/pull/20758#discussion_r1782438254
More information about the hotspot-runtime-dev
mailing list