-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8338136: Hotspot should support multiple large page sizes on Windows #20758
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
Conversation
|
👋 Welcome back dhanalla! A progress list of the required criteria for merging this PR into |
|
@dhanalla This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 479 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@dholmes-ora, @djelinski) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
dholmes-ora
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @dhanalla ,
What criteria do you think would suffice for EnableAllLargePageSizesForWindows to default to true or else be removed altogether, in the future?
Thanks @dholmes-ora for reviewing this PR. To determine the best time to set |
|
@dhanalla do you think your customers will be okay running with an experimental flag enabled? The changes seem fine. I'm running them through our CI with the flag disabled and enabled to see if anything interesting happens. |
|
The interesting tests were skipped: what do you need to make the "lock memory privilege" available? EDIT: never mind I found it. |
Thanks for running through CI. |
@dholmes-ora, Could you please advise if we can remove the 'experimental' designation for EnableAllLargePageSizesForWindows and keep it set to false by default for now, with the possibility of changing it to true by default or removing it at a later date? |
|
If you want the flag to be a full blown product flag then you just need to create a CSR request and get that approved. BTW I'm still trying to get a test environment where we have the lock-pages-in-memory privilege to test this. |
@dholmes-ora, May I know if the test is complete and if the results are as expected? |
|
Sorry @dhanalla we are having some technical problem getting a test environment configured. I will approve now but you still need a second reviewer. If any issues arise we will deal with them at the time. |
djelinski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with JVM's memory handling, so just a few general observations...
| WARN("The specified large page size (%d) is not a multiple of the minimum large page size (%d), defaulting to minimum page size.", LargePageSizeInBytes, size); | ||
| } | ||
| } else { | ||
| WARN("The JVM cannot use large pages because the large page size setting is not configured, defaulting to minimum page size (%d).", size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct; the warning message does seem misleading. The LargePageSizeInBytes=0 is meant to use the default large page size, which the surrounding code already handles. Therefore, the warning about large pages not being configured is unnecessary.
We can remove this warning and adjust the code to reflect the intended use of default large page sizes when
LargePageSizeInBytes is zero.
| #if defined(IA32) || defined(AMD64) | ||
| if (size > 4*M || LargePageSizeInBytes > 4*M) { | ||
| #if defined(IA32) | ||
| if (size > 4 * M || LargePageSizeInBytes > 4 * M) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @djelinski for reviewing this PR.
fixed the indentation.
| size_t min_size = GetLargePageMinimum(); | ||
|
|
||
| // 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. | ||
| for (size_t page_size = min_size; page_size < _large_page_size; page_size *= 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows can use different large page sizes based on hardware support, not limited to the default 2MB. The implementation examines the system's supported page sizes and selects an appropriate size using the LargePageSizeInBytes parameter.
The code accommodates non-power-of-two sizes, such as 6MB, while ensuring these sizes are multiples of the system's minimum large page size to prevent potential issues. If an invalid size is specified, the code defaults to the minimum supported size and issues a warning.
djelinski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
|
/integrate |
|
/sponsor |
|
Going to push as commit 4ded283.
Your commit was automatically rebased without conflicts. |
|
@dholmes-ora @dhanalla Pushed as commit 4ded283. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
|
/backport jdk23u |
|
@dhanalla the backport was successfully created on the branch backport-dhanalla-4ded2838-master in my personal fork of openjdk/jdk23u. To create a pull request with this backport targeting openjdk/jdk23u:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk23u: |
|
/backport jdk21u-dev |
|
@dhanalla the backport was successfully created on the branch backport-dhanalla-4ded2838-master in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev: |
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.
Progress
Issues
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20758/head:pull/20758$ git checkout pull/20758Update a local copy of the PR:
$ git checkout pull/20758$ git pull https://git.openjdk.org/jdk.git pull/20758/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20758View PR using the GUI difftool:
$ git pr show -t 20758Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20758.diff
Webrev
Link to Webrev Comment