-
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 #8884
8210708: Use single mark bitmap in G1 #8884
Conversation
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 |
/label add hotspot-gc |
@tschatzl |
Webrevs
|
a511be5
to
ef0acc7
Compare
The change before 665350f passed tier1-8 (sans the issue with |
I am going to close this PR because during internal review @albertnetymk prodded me long enough about why we need the backwards scanning (because of crashes) so that we looked at these crashes again and found a way to not require the backwards scans at all. |
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:
Scanning backwards is a somewhat slow process, particularly since we do not know how far back the last previous object actually is: for this reason this change introduces a `Back scan skip table", which is like a very coarse bitmap (64k bytes/"mark" by default - that's 16 bytes per MB of heap, i.e. 0.0015% of the heap - configurable) that aids in scanning back very large areas.
Testing showed that the need for this back scan skip table is extremely seldom (like ten occurrences in millions of attempts), but if so, these skips are substantial.
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 totams
) that indicates from which address within the region the heap is parsable.Let me describe the relation of
tams
andpb
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
totams
, 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 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 tobottom
as a region finishes scrubbing to decrease the size of the area we need to use the bitmap as 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:
tams
in the concurrent start pause, otherwise the bitmap is cleared.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), tier1-8 (with a slightly older version that does not contain latest cleanups, will do again)
Thanks,
Thomas
Progress
Integration blocker
Issue
Contributors
<sjohanss@openjdk.org>
<iwalulya@openjdk.org>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/8884/head:pull/8884
$ git checkout pull/8884
Update a local copy of the PR:
$ git checkout pull/8884
$ git pull https://git.openjdk.java.net/jdk pull/8884/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 8884
View PR using the GUI difftool:
$ git pr show -t 8884
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/8884.diff