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

8325673: GenShen: Share Reserves between Old and Young Collector #395

Closed
wants to merge 82 commits into from

Conversation

kdnilsen
Copy link
Contributor

@kdnilsen kdnilsen commented Feb 12, 2024

Allow young-gen Collector reserve to share memory with old-gen Collector reserve in order to support prompt processing of mixed evacuations, as constrained by ShenandoahOldEvacRatioPercent.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (1 review required, with at least 1 Committer)

Issue

  • JDK-8325673: GenShen: Share Reserves between Old and Young Collector (Bug - P5)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/shenandoah.git pull/395/head:pull/395
$ git checkout pull/395

Update a local copy of the PR:
$ git checkout pull/395
$ git pull https://git.openjdk.org/shenandoah.git pull/395/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 395

View PR using the GUI difftool:
$ git pr show -t 395

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/shenandoah/pull/395.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 12, 2024

👋 Welcome back kdnilsen! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 12, 2024
@mlbridge
Copy link

mlbridge bot commented Feb 12, 2024

@kdnilsen kdnilsen marked this pull request as draft February 12, 2024 20:49
@openjdk openjdk bot removed the rfr Pull request is ready for review label Feb 12, 2024
Given that mixed evacuation will sometimes borrow up to this amount of
memory from the young evacuation reserve for old evacuations, we reduce
the default value to reduce the impact on normal young GC.
1. Always require that evacuation reserve quantities be established
   before rebuilding free set

2. Establish evacuation reserve quantities before initial rebuild of
   free set

3. Fix the calucation of old reserves during adjust generation sizes
   for next gc cycle
When we round up, we introduce the risk that the new size exceeds the
maximum LAB size, resulting in an assertion error.
In the previous implementaiton, reserve quantities were only sometimes
established.
@openjdk
Copy link

openjdk bot commented Feb 27, 2024

@kdnilsen this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout share-collector-reserves
git fetch https://git.openjdk.org/shenandoah.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Feb 27, 2024
@openjdk
Copy link

openjdk bot commented Mar 13, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

Limit the size of old-gen by memory available in the OldCollector set
following find_regions_with_alloc_capacity() (rather than limiting the
size of old-gen by the total capacity of the OldCollector set, which
includes used memory).
Soft capacities are established, for example, by setting NewRatio or New size on the
JVM command line.  GenShen, for now at least, does not honor these settings.  Better
performance is obtained by allowing GenShen to expand and shrink generation sizes
according to application behavior.

This commit also tidies up various aspects of the implementation to make adjustments
to generation sizing more consistent:

1. ShenandoahGlobalHeuristics::choose_global_collection_set(): share the reserves
   between young and old collection to maximize evacuation of garbage-first
   regions, regardless of whether most garbage is found in old or young
2. ShenandoahConcurrentGC::entry_final_roots(): do not balance generations before
   invoking finish_rebuild() because finish_rebuild will balance generations.
3. ShenandoahFreeSet::flip_to_old_gc(): invoke force_transfer_to_young() instead
   of transfer_to_young() so we can override soft-capacity limits
4. ShenandoahFullGC::phase5_epilog(): Do not invoke compute_balances() or
   balance_generations_after_rebuilding_free_set().  Allow the free-set
   rebuild() implementation to do this work in a more consistent fashion.
5. ShenandoahGeneration::adjust_evacuation_budgets(): replace transfer_to_youn()
   with force_transfer_to_young() to avoid enforcement of soft capacity limits.
6. ShenandoahGenerationSizer::force_transfer_to_young(): new method
7. ShenandoahGenerationalFullGC::balance_generations_after_gc(): establish
   reserves() so that free-set rebuild() can adjust balance.  Do not redundantly
   force transfer of regions here.
8. ShenandoahGenerationalFullGC::balance_generations_after_rebuilding_free_set():
   deprecate this method.
9. ShenandoahGenerationalFullGC::compute_balances(): deprecate this method.
10. ShenandoahGenerationaStatsClosure::validate_usage() (part of Shenandoah
    Verification): add consistency check for generation capacities
@kdnilsen kdnilsen marked this pull request as ready for review July 15, 2024 14:26
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 15, 2024
return true;
}

void ShenandoahOldHeuristics::initialize_piggyback_evacs(ShenandoahCollectionSet* collection_set,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we continue using mixed instead of piggyback to describe collections that include young and old regions? I think mixed is an accepted term and piggyback feels a little bit too colloquial (also not sure if the phrase is commonly known outside of English).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion. Thanks. I'm replacing piggyback with mixed throughout (where piggyback means mixed evac). There are a few places where piggyback in Shenandoah where piggyback is used for other purposes and I'm leaving those as is.

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Jul 22, 2024
Copy link
Member

@ysramakrishna ysramakrishna left a comment

Choose a reason for hiding this comment

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

Left a few suggestions; would be great to take care of the re-order thing that confuses the github diffs. Not sure if restoring old order of those methods in shenandoahOldHeuritsics.cpp is possible/easy. See comments inline.

Flushing these for now, but will continue in that file and remaining ones in a subsequent session later today/tomorrow.

@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Aug 12, 2024
@bridgekeeper
Copy link

bridgekeeper bot commented Sep 10, 2024

@kdnilsen This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 8, 2024

@kdnilsen This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

3 participants