-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8314573: G1: Heap resizing at Remark does not take existing eden regions into account #15400
8314573: G1: Heap resizing at Remark does not take existing eden regions into account #15400
Conversation
👋 Welcome back tschatzl! A progress list of the required criteria for merging this PR into |
I don't think they are the same -- in full-gc case eden is indeed empty, while in remark-pause the patch treats eden as empty even when it's not. The version on master treats eden as full and do the heap resizing (expand/shrink). Can we permit only shrink in remark-pause, since eden liveness is unknown at that moment? (Remark-pause occurs not due to alloc-failure, so it is kind of logical not to expand the heap.) |
The marking cycle should be a replacement a full collection (or that is the idea), including heap resizing. Eden allocations are in some way as if they did not exist from a full collection heap resizing POV. This change implements this (to some degree).
We could do an approximation, but for the sake of simplicity this change does not.
I do not follow this. When to resize the heap is arbitrary, but it seems to be the "best" place to simulate a full collection cycle. |
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.
Looks good, per the problem description.
Seems like "used_after_gc" is a confusing name though. Maybe fix that later, unless you
have a better idea right now (I don't).
@tschatzl 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 92 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. ➡️ To integrate this PR with the above commit message to the |
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.
Had some offline discussion with Thomas -- this treating-eden-as-free can lead to over-shrinking if using non-default flag values, but that may be a less severe problem than over-expansion.
(Allowing only shrink in Remark is another option, but it would be a larger diff.)
Thanks @albertnetymk @kimbarrett for your reviews /integrate |
Going to push as commit 762b652.
Your commit was automatically rebased without conflicts. |
/backport jdk21u-dev |
@mmyxym the backport was successfully created on the branch backport-mmyxym-762b6529 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:
|
Hi all,
can I have reviews for this change that tries to make the heap resizing policy at Remark more similar to the one after full GC?
The problem is that when calculating the amount of free regions to apply the Min/MaxHeapFreeRatio during Remark g1 does not consider that at Remark we might have already allocated lots of eden regions.
Which means that the heap appears fuller than it would be during full gc, which means that Remark sometimes expands very aggressively due to MinHeapFreeRatio setting. I.e. if at the time of remark pause free regions
There should be no impact wrt to shrinking: MaxHeapFreeRatio is by default (70%) larger than the maximum eden/young gen size (G1MaxNewSizePercent = 60%), so there should be no additional shrinking (that would only lead to additional heap expansion later).
I am aware that fiddling with the values (MaxHeapFreeRatio/G1MaxNewSizePercent) may create a situation where g1 would immediately increase the heap afterwards due to young gen being able to be larger than MaxHeapFreeRatio (if G1MaxNewSizePercent > MaxHeapFreeRatio and G1 would use that large young gen). However this is no different to the current situation after full gc, so I would like to keep it as is. Also for the sake of not complicating this (imo) straightforward change.
A more comprehensive improvement to the problem would be JDK-8238687, where we do the resizing when eden is empty after young gc, but I think this is out of scope here: this fix improves the situation recently reported to me where g1 suddenly started to expand a lot during Remark after upgrades, and should also fix the issue reported in https://bugs.openjdk.org/browse/JDK-6490394 in the last comment (which has been reported around 1 year after the push, which means likely it got overlooked).
Testing: tier1-3, internal perf testing with no changes
Thanks,
Thomas
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15400/head:pull/15400
$ git checkout pull/15400
Update a local copy of the PR:
$ git checkout pull/15400
$ git pull https://git.openjdk.org/jdk.git pull/15400/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15400
View PR using the GUI difftool:
$ git pr show -t 15400
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15400.diff
Webrev
Link to Webrev Comment