-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8210708: Use single mark bitmap in G1 #8957
8210708: Use single mark bitmap in G1 #8957
Conversation
initial version
Remove prev_bitmap fix compilation Do scrubbing concurrently Better naming and comments Improve naming and comments with regards to prev-next Fix compilation Add obj_is_scrubbed helper Move rebuild of remsets into scrubbing phase Remove old rebuild and some additional cleanups Unify humongous and large objects rebuilding Cleanups Cleanups and some restructuring Search for live block for concurrent refinement Fix to not scan past MR Fix limit for humongous rebuild Add marked_words verification to scrub_and_rebuild merged smb with filler objects Fix merge error Remove ptams Fix marked bytes assignment Refactoring typo Improve scanning the cards by distinguishing between a path for objects >= parsable_bottom and others Update _parsable_bottom concurrently to minimize the time taking the slow-path during refinement Humongous regions have their _parsable_bottom always set to _bottom because they never need scrubbing Fix iteration of humongous objects causing missing remembered set entries Some cleanup, added helper methods Fix cleanup Move out rebuilding and scrubbing algorithm into separate files Make new class allstatic First attempt at backwards scan method Fix backward scan Remove obsolete code Fix test Fix is_obj_dead_size optimizations Undo changes in tests Backstep table, first attempt Fix assert, add log messages Cleanup, clearing back skip table Prev bitmap scan fix cleanup bad-cleanup Prepare for merge with extracted changes, cleanup some fixes Hunting gc/g1/humongousObjects/TestNoAllocationsInHRegions.java crash get_prev_bit_impl documentation
/contributor add @kstefanj |
👋 Welcome back tschatzl! A progress list of the required criteria for merging this PR into |
@tschatzl |
@tschatzl |
@tschatzl |
Webrevs
|
fix compilation... ayang comments Some cleanup aborted full collection fix Minor changes More cleanup
Some comments about the latest commits while searching for a bug that has been found out to actually not be caused by this change (but occurs more often):
|
Fix issue with region liveness logging, using outdated value
@tschatzl this pull request can not be integrated into git checkout submit/8210708-drop-single-bitmap5
git fetch https://git.openjdk.org/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
The latest patch has been checked against PR#9377 and PR#9376. |
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.
Lgtm!
@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 33 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 |
Thanks a lot @albertnetymk @walulyai for your reviews. /integrate |
Going to push as commit 95e3190.
Your commit was automatically rebased without conflicts. |
Do you have any before-after performance numbers for the change? (If so, would make sense to add to the JBS ticket.) |
Hi all,
can I have reviews for this change that removes one of the mark bitmaps in G1 to save memory?
Previously G1 used two mark bitmaps, one that has been in use for current liveness determination ("prev bitmap"), one that is currently being built ("next bitmap"); these two then were swapped during the remark pause.
G1 needed the current liveness information to determine whether an object (and the corresponding klass) below the respective top-at-mark-start is live, i.e. could be read from.
The mechanism is described in detail in the "Garbage-First Garbage Collection Paper" by Detlefs et al (doi).
This mechanism has several drawbacks:
The alternative presented here is to reformat the holes between objects with filler objects; this is a traditional sweep over the heap which has originally been considered fairly expensive. However since JDK 11 G1 already does that sweep anyway when rebuilding remembered sets, and during this investigation it has been shown that reformatting the holes is "for free".
That reformatting not only includes actually stuffing filler objects into these holes, but also updating the BOT concurrently.
This concurrency has some drawback: after class unloading (in the remark pause) and before the Cleanup pause (which indicates the end of the concurrent rebuilding of the remsets and scrubbing the regions phase) using the BOT needs some care:
Above I mentioned that there is a distinction between objects that can be parsed directly and objects for which we need to use the bitmap. For this reason the code introduces a per-region new marker called
parsable_bottom
(typically calledpb
in the code, similar to tams) that indicates from which address within the region the heap is parsable.Let me describe the relation of tams and pb during the various phases in gc:
Young-only gcs (and initial state):
pb = tams = tars = bottom
; card scanning always uses the BOT/direct scanning of the heapDuring Concurrent Mark Start until Remark:
tams = top, pb = bottom
; concurrent marking runs; we can still use BOT/direct scanning of the heap for refinement and gc card scan.Marking not only marks objects from bottom to tams, but also sets a flag in the back scan skip table on a fairly coarse basis.
From Remark -> Cleanup:
pb = tams; tams = bottom; tars = top;
Remark unloaded classes, so we setpb
totams
; in the region at addresses <tams
we might encounter unparsable objects. This means that during this time, refinement can not use the BOT to find valid objects spanning into the card it wants to scan as described above. Use the bitmap for that.Rebuild the remembered sets from
bottom
totars
, and scrub the heap frombottom
topb
.Note that the change sets
pb
incrementally (and concurrently) back to bottom as a region finishes scrubbing to decrease the size of the area we need to use the bitmap to help as a BOT replacement.Scrubbing means: put filler objects in holes of dead objects, and update the BOT according to these filler objects.
As soon as scrubbing finishes on a per-region basis: Set
pb
tobottom
- the whole region is now parsable again. At Cleanup, all regions are scrubbed.Evacuation failure handling: evacuation failure handling has been modified to accomodate this:
Thanks go to @kstefanj for the initial prototype, @walulyai for taking over for a bit. I'll add both as contributors/authors.
Testing: tier1-5 (multiple times), tier 6-8 (running, but the previous version in PR#8884 completed this one fine)
Thanks,
Thomas
Progress
Issue
Reviewers
Contributors
<sjohanss@openjdk.org>
<iwalulya@openjdk.org>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/8957/head:pull/8957
$ git checkout pull/8957
Update a local copy of the PR:
$ git checkout pull/8957
$ git pull https://git.openjdk.org/jdk pull/8957/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 8957
View PR using the GUI difftool:
$ git pr show -t 8957
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/8957.diff