Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotspot should support multiple large page sizes on Windows #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nitinsingh130519
Copy link

@nitinsingh130519 nitinsingh130519 commented Aug 20, 2024

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 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.

@nitinsingh130519 nitinsingh130519 changed the title Upgrade Multi-Size Page Handling for Enhanced Large Page Support in M… Upgrade Multi-Size Page Handling for Enhanced Large Page Support in MSFT OpenJDK on Windows Aug 20, 2024
@nitinsingh130519 nitinsingh130519 changed the title Upgrade Multi-Size Page Handling for Enhanced Large Page Support in MSFT OpenJDK on Windows Upgrade Multi-Size Page Handling for Enhanced Large Page Support in OpenJDK on Windows Aug 20, 2024
@nitinsingh130519 nitinsingh130519 changed the title Upgrade Multi-Size Page Handling for Enhanced Large Page Support in OpenJDK on Windows Hotspot should support multiple large page sizes on Windows Aug 20, 2024
@@ -3307,14 +3307,15 @@ static char* allocate_pages_individually(size_t bytes, char* addr, DWORD flags,
return p_buf;
}

static size_t large_page_init_decide_size() {
size_t os::win32::large_page_init_decide_size() {
// print a warning if any large page related flag is specified on command line
bool warn_on_failure = !FLAG_IS_DEFAULT(UseLargePages) ||
!FLAG_IS_DEFAULT(LargePageSizeInBytes);

#define WARN(msg) if (warn_on_failure) { warning(msg); }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make the macro to allow variable parameters
#define WARN(...) if (warn_on_failure) { warning(VA_ARGS); }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i made this change in upstream PR openjdk#20758
also validated the gtest

size = LargePageSizeInBytes;
} else {
char buffer[256];
snprintf(buffer, sizeof(buffer), "The specified large page size (%d) is not a multiple of the minimum large page size (%d), defaulting to minimum page size.", LargePageSizeInBytes, size);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use macro WARN after making it to accept variable parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants