RFR: JDK-8262068: Improve G1 Full GC by skipping compaction for regions with high survival ratio [v8]

Thomas Schatzl tschatzl at openjdk.java.net
Thu Mar 18 14:39:41 UTC 2021


On Thu, 18 Mar 2021 14:22:49 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> After a short look I think the only changes that are needed to get a region to be considered pinned in the g1 full gc is in `G1FullCollector::update_attribute_table()` to set these regions that are too full as "pinned" for that collection.
>> 
>> There are two places in `G1FullCollector` where that attribute table isn't used yet, but the code uses `HeapRegion::is_pinned()` directly (search for `r->is_pinned()` in the full gc files, I think both are located in `g1FullGCCompactTask.cpp`). These should be rerouted to that table I think.
>> 
>> After that change everything should basically be still working.
>> 
>> No guarantees though.
>
> Thanks for the suggestion, will try it.
> For "last-ditch" issue, we plan to re-use some flag/logic in soft-ref, would like to hear your suggestion in advance if it's convenient for you.

in `G1CollectedHeap::satisfy_failed_allocation` there is this comment:

     // Attempts to allocate followed by Full GC that will collect all soft references.

That would be the start of this "last-ditch" collection. At this point it may be possible to use the `clear_all_soft_references` as indication that we should be maximally compacting in that full gc. You would need to check if a full GC with that flag set to true is always a "maximally compacting collection" (there is one path with a comment indicating that this is intended). If that is the case (idk, I haven't looked all paths), then it would be appropriate to rename that parameter to something like `do_maximal_compaction` everywhere.

And pass that information, that this collection should ignore the "dead wood" into the `G1FullCollector`.

Otherwise I'd start with adding another truly maximally compacting full gc that also gets this info passed into it at the end of `G1CollectedHeap::satisfy_failed_allocation`.

This is only a general idea about this, no guarantees that I won't object to this later if that were implemented ;)

-------------

PR: https://git.openjdk.java.net/jdk/pull/2760



More information about the hotspot-gc-dev mailing list