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

8275056: Virtualize G1CardSet containers over heap region #6059

Conversation

tschatzl
Copy link
Contributor

@tschatzl tschatzl commented Oct 21, 2021

Hi all,

can I have reviews for this change that virtualizes G1CardSet "regions" over a heap region, allowing the use of multiple "G1CardSet card regions" across a single heap region?

I.e. HeapRegionRemSet, which is the interface to a region's card set, simply uses multiple indexes for the remembered set of a single source heap region if necessary. E.g. on a 128MB region, heap region 0's cards would be stored as (what I call) "card region" indexes 0..3 as appropriate in its _card_set.

When retrieving the values, the appropriate retransformation is done (during HeapRegionRemSet::iterate_for_merge()).

Assigning HeapRegionRemSet to handle all this multiplexing required some move of the G1CardSet::iterate_for_merge method to HeapRegionRemSet, which is why there are more changes than expected.

One change I would like to have opinions on is storing the amount of card regions per region into G1CardSetConfiguration, maybe it is better to put this into HeapRegionRemSet - but I did not want to start a HeapRegionRemSetConfiguration (maybe also put the cached values introduced in the split_card optimization there as well?).

This allows unlimited actual heap region size. Currently set to 512MB (what we would set ergonomically if on a 1 TB heap), but that's just a random number basically.
Feel free to suggest a different maximum heap region size if any. We could also keep the ergonomics use a smaller heap region size (e.g. 32M as before).

There is also a CSR to look at.

Testing: tier1-5, some perf testing on region sizes up to 512M with slight improvements in specjbb2015 with larger region sizes.

Thanks,
Thomas


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8275056: Virtualize G1CardSet containers over heap region

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6059/head:pull/6059
$ git checkout pull/6059

Update a local copy of the PR:
$ git checkout pull/6059
$ git pull https://git.openjdk.java.net/jdk pull/6059/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6059

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6059.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 21, 2021

👋 Welcome back tschatzl! 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 label Oct 21, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Oct 21, 2021

@tschatzl The following label will be automatically applied to this pull request:

  • hotspot-gc

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot-gc label Oct 21, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Oct 21, 2021

@openjdk
Copy link

@openjdk openjdk bot commented Oct 25, 2021

@tschatzl 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 submit/8275056-virtualize-g1cardset-containers2
git fetch https://git.openjdk.java.net/jdk 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 label Oct 25, 2021
@tschatzl tschatzl changed the title 8275266: Virtualize G1CardSet containers over heap region 8275056: Virtualize G1CardSet containers over heap region Oct 27, 2021
@openjdk openjdk bot removed the merge-conflict label Oct 27, 2021
Copy link
Contributor

@kstefanj kstefanj left a comment

Looks good, just a couple of small comments.

src/hotspot/share/gc/g1/g1CardSet.cpp Outdated Show resolved Hide resolved
src/hotspot/share/gc/g1/g1CardSet.cpp Outdated Show resolved Hide resolved
@openjdk
Copy link

@openjdk openjdk bot commented Oct 27, 2021

@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:

8275056: Virtualize G1CardSet containers over heap region

Reviewed-by: sjohanss, ayang

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 78 new commits pushed to the master branch:

  • ca2efb7: 8274687: JDWP deadlocks if some Java thread reaches wait in blockOnDebuggerSuspend
  • 296780c: 8276983: Small fixes to DumpAllocStat::print_stats
  • 8c5f030: 8276453: Undefined behavior in C1 LIR_OprDesc causes SEGV in fastdebug build
  • 176d21d: 8276824: refactor Thread::is_JavaThread_protected
  • 74f3e69: 8277071: [BACKOUT] JDK-8276743 Make openjdk build Zip Archive generation "reproducible"
  • b85500e: 8276123: ZipFile::getEntry will not return a file entry when there is a directory entry of the same name within a Zip File
  • 0d2980c: 8258192: Obsolete the CriticalJNINatives flag
  • 5a2452c: 8274835: Remove unnecessary castings in java.base
  • 3b2585c: 8276658: Clean up JNI local handles code
  • aeba653: 8276743: Make openjdk build Zip Archive generation "reproducible"
  • ... and 68 more: https://git.openjdk.java.net/jdk/compare/ea23e7333e03abb4aca3e9f3854bab418a4b70e2...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Oct 27, 2021
@tschatzl
Copy link
Contributor Author

@tschatzl tschatzl commented Oct 27, 2021

Reran tier1-5 without issues (except assert problem that has been fixed in bdf9950).

@tschatzl
Copy link
Contributor Author

@tschatzl tschatzl commented Oct 28, 2021

After some discussion with @kstefanj we thought it would be best to limit the ergonomics to 32M regions (the previous maximum) since the choice of heap region size affects several other internal tuning (chunk sizing for scanning remembered sets, parallelism). Their impact has not been explored too much.

The user may still manually select larger sizes up to 512M at the moment, assuming that if you override the defaults, we assume that you will measure the impact appropriately. Of course, feedback by users about their choice is appreciated.

@tschatzl
Copy link
Contributor Author

@tschatzl tschatzl commented Nov 8, 2021

With the change for JDK-8276548 / PR#6230 now in (I merged it for your convenience), this change works now :) There has been no change in this PR, but the processing of "Full" cards has been wrong with region virtualization.

Copy link
Member

@albertnetymk albertnetymk left a comment

Just some minor comments/suggestions.

void do_cardsetptr(uint region_idx, size_t num_occupied, G1CardSet::CardSetPtr card_set) override {
CardOrRanges<Closure> cl(_iter,
region_idx >> _log_card_regions_per_region,
(region_idx & _card_regions_per_region_mask) << _log_card_region_size);
_card_set->iterate_cards_or_ranges_in_container(card_set, cl);
Copy link
Member

@albertnetymk albertnetymk Nov 14, 2021

Choose a reason for hiding this comment

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

region_idx is actually card_region_idx, right? If so, card_region_idx >> _log_card_regions_per_region ==> region_idx (the second arg of G1ContainerCardsOrRanges constructor) makes sense to me.

Copy link
Contributor Author

@tschatzl tschatzl Nov 15, 2021

Choose a reason for hiding this comment

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

Yes, that is the unchanged "region" that the hash table for the containers sees, which is the card_region_idx at this level.

(uint)HeapRegion::CardsPerRegion, /* max_cards_in_cardset */
default_log2_card_region_per_region()) /* log2_card_region_per_region */
{
assert((_log2_card_region_per_heap_region + _log2_card_region_size) == (uint)HeapRegion::LogCardsPerRegion,
Copy link
Member

@albertnetymk albertnetymk Nov 14, 2021

Choose a reason for hiding this comment

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

I suggest _log2_card_region_size -> _log2_cards_per_card_region; then the assertion becomes more consistent, IMO.
assert((_log2_card_region_per_heap_region + _log2_cards_per_card_region) == (uint)HeapRegion::LogCardsPerRegion), which, in math form, is
(card_region / heap_region) x (cards / card_region) == cards / (heap_)region

Copy link
Contributor Author

@tschatzl tschatzl Nov 15, 2021

Choose a reason for hiding this comment

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

Implemented. I'll push in around 7-8 hours unless somebody objects.

@tschatzl
Copy link
Contributor Author

@tschatzl tschatzl commented Nov 15, 2021

Thanks @albertnetymk @kstefanj for your reviews.

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Nov 15, 2021

Going to push as commit 1830b8d.
Since your change was applied there have been 85 commits pushed to the master branch:

  • fe45835: 8274856: Failing jpackage tests with fastdebug/release build
  • 9046077: 8276084: Linux DEB Bundler: release number in outputted .deb file should be optional
  • 7fc344d: 8277028: Use service type documentation as fallback for @provides
  • 35a831d: 8272170: Missing memory barrier when checking active state for regions
  • 02f7900: 8276932: G1: Annotate methods with override explicitly in g1CollectedHeap.hpp
  • fdcd16a: 8277048: Tiny improvements to the specification text for java.util.Properties.load
  • b231f5b: 8276921: G1: Remove redundant failed evacuation regions calculation in RemoveSelfForwardPtrHRClosure
  • ca2efb7: 8274687: JDWP deadlocks if some Java thread reaches wait in blockOnDebuggerSuspend
  • 296780c: 8276983: Small fixes to DumpAllocStat::print_stats
  • 8c5f030: 8276453: Undefined behavior in C1 LIR_OprDesc causes SEGV in fastdebug build
  • ... and 75 more: https://git.openjdk.java.net/jdk/compare/ea23e7333e03abb4aca3e9f3854bab418a4b70e2...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 15, 2021
@openjdk openjdk bot added the integrated label Nov 15, 2021
@openjdk openjdk bot removed ready rfr labels Nov 15, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 15, 2021

@tschatzl Pushed as commit 1830b8d.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@tschatzl tschatzl deleted the submit/8275056-virtualize-g1cardset-containers2 branch Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-gc integrated
3 participants