-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8352765: G1CollectedHeap::expand_and_allocate() may fail to allocate even after heap expansion succeeds #24257
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 iwalulya! A progress list of the required criteria for merging this PR into |
@walulyai 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 109 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 |
Webrevs
|
src/hotspot/share/gc/g1/g1Policy.cpp
Outdated
"receiving young %u receiving additional eden %u", | ||
receiving_young, | ||
receiving_eden, |
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 log message reads "receiving young" still.
"receiving additional eden %u", | ||
free_outside_reserve, receiving_within_reserve, | ||
receiving_young, receiving_additional_eden); | ||
receiving_eden, receiving_additional_eden); |
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.
Log message needs update.
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 for the quick fix!
I just have a two questions, which probably does not need to be addressed in this PR.
- Is it possible for
expand_and_allocate()
to run into thereceiving_additional_eden = 0;
situation under theif (allocated_young_length >= desired_young_length)
branch? - It feels like G1 should recalculate young list length parameters after a successful
expand()
orshrink()
. CurrentlyG1Policy::record_new_heap_size()
only recalculates the min/max young lengths. Is it reasonable to runcalculate_young_desired_length()
andcalculate_young_target_length()
insideG1Policy::record_new_heap_size()
?
Yes, I think we need to do the recalculation after expand as the expansion changes the number of free regions available and so should affect the young_[desired,target]_lengths. Otherwise, it is possible to expand and fail allocation. This can be addressed in a separate PR though. No, scratch that; after GC, the desired_young_length > allocated_young_length. |
Going to push as commit 804a8fa.
Your commit was automatically rebased without conflicts. |
Hi,
Please review this change to ensure that G1 provisions for at least one Eden region after a GC when computing the young length target.
The issue reported in the CR occurs at the end of a GC, after successfully expanding the heap, an allocation fails because
policy()->should_allocate_mutator_region()
returns false. This happens because the computation did not properly account for young regions already allocated as survivor regions, leading to an Eden region target of zero.With this change, we factor in the young regions that have already been allocated as survivor regions and ensure that at least one region is targeted for Eden.
Testing: Tier 1-3
Reproducer in the CR.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24257/head:pull/24257
$ git checkout pull/24257
Update a local copy of the PR:
$ git checkout pull/24257
$ git pull https://git.openjdk.org/jdk.git pull/24257/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24257
View PR using the GUI difftool:
$ git pr show -t 24257
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24257.diff
Using Webrev
Link to Webrev Comment