-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8354145: G1: UseCompressedOops boundary is calculated on maximum heap region size instead of maxiumum ergonomic heap region size #24541
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 tbzhang! A progress list of the required criteria for merging this PR into |
@tbzhang 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 366 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 (@tschatzl, @lmesnik, @albertnetymk) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
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.
Would it be possible to add a regression test that checks the value of the UseCompressedOops
flag after running a VM with these settings?
Thanks for your suggestion, I will add a test. |
…ionSize explicitly
6b13908
to
c31c734
Compare
@tbzhang Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information. |
* @modules java.base/jdk.internal.misc | ||
* @modules java.management/sun.management | ||
* @library /test/lib | ||
* @library / |
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.
Why this line is needed? I don't see any dependencies on "/"
If you use some test code outside directory, better to build them.
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.
Why this line is needed? I don't see any dependencies on "/" If you use some test code outside directory, better to build them.
Yes, the GCArguments depends on the @library /
, many tests in test/hotspot/jtreg/gc/arguments
use this
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.
Afaict GCArguments
only depends on test.lib.*
too.
Other than that, the use of the @library
directives is often just copy&paste without particular meaning.
* @bug 8354145 | ||
* @requires vm.gc.G1 & vm.opt.G1HeapRegionSize == null | ||
* @summary Verify that the flag TestG1CompressedOops is updated properly | ||
* @modules java.base/jdk.internal.misc |
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.
Is any of those 2 modules is used by tests? I don't see it in the test.
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.
removed these two modules
/* | ||
* @test TestG1CompressedOops | ||
* @bug 8354145 | ||
* @requires vm.gc.G1 & vm.opt.G1HeapRegionSize == null |
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.
The test ignores external VM flags, so vm.opt.G1HeapRegionSize is not needed.
But it is needed to add
* @requires vm.flagless
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.
done
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.
Sorry, I wanted to ask you to change test, not approve it yet.
Got it, thanks for the review. |
* @modules java.base/jdk.internal.misc | ||
* @modules java.management/sun.management | ||
* @library /test/lib | ||
* @library / |
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.
Afaict GCArguments
only depends on test.lib.*
too.
Other than that, the use of the @library
directives is often just copy&paste without particular meaning.
This may be a stupid question, but why does the heap region size factor into this decision at all? I assume that both heap base and heap max size are aligned to heap region size? |
I wonder if it's due to
The actual heap starts after the null-page, and the null-page takes the heap-region size in order for heap-start to be aligned. |
From the calculation for max heap for compressed oops:
This conservative max heap alignment is what we change from absolute maximum (512M) to what the ergonomics would at most use (32M). At that point we can only use these conservative values, because ergonomics only later decides heap region size based on max heap size which the code may not have at this point. |
Thanks @albertnetymk @tbzhang, that makes sense:
In Metaspace, I do this differently: jdk/src/hotspot/share/memory/metaspace.cpp Line 816 in 6a0c24f
Here, the Null area is part of the first Root chunk segment. I set up class space starting at encoding base, then allocate a smaller area from that chunk, protect it, and never free it again. I very briefly wondered why this was not possible in the java heap (e.g. protect the first page of the first region) but that would be a worse solution for many reasons. It would mean region 0 requires special attention, would prevent it from being collected normally, would mean we had to find a separate solution for every collector etc. Rather just live with wasting a bit of address space at the front of the heap. |
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 PR is good by itself.
Maybe in a followup, one can explore the possibility of adjusting (e.g. align-down instead) max-heap-size somewhere in order to avoid the current circular dependency.
Thanks for the review! |
/integrate |
/sponsor |
Going to push as commit 526951d.
Your commit was automatically rebased without conflicts. |
@albertnetymk @tbzhang Pushed as commit 526951d. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
After JDK-8275056, The max heap region size became 512M, and the calculation of CompressedOops based on the max_heap_size - max_heap_region_size.
So before this patch, the CompressedOops will turn on below 32G - 32m, After this patch is 32G -512m.
When our Apps migrating from JDK11 to JDK21, the heap size parameters(Xmx32736m) will turn off the CompressedOops.
Since the current max ergonomics size is still 32m, We hoped that the original behavior will not be changed if HeapRegionSize is not explicitly set.
before this patch:
after this patch:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24541/head:pull/24541
$ git checkout pull/24541
Update a local copy of the PR:
$ git checkout pull/24541
$ git pull https://git.openjdk.org/jdk.git pull/24541/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24541
View PR using the GUI difftool:
$ git pr show -t 24541
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24541.diff
Using Webrev
Link to Webrev Comment