RFR: JDK-8262068: Improve G1 Full GC by skipping compaction for regions with high survival ratio [v8]
Hamlin Li
mli at openjdk.java.net
Mon Mar 22 01:15:39 UTC 2021
On Fri, 19 Mar 2021 13:19:17 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:
>> 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 ;)
>
>> 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.
>
> I think this sounds like a good approach as well, renaming the second parameter of `do_full_collection(bool, bool)` to something like that. Then I think we might want to add a new bool parameter to the `G1FullCollector` constructor to signal if this should be a "maximum" compaction. I think this is needed since we in `do_full_collection()` also is considering the `soft_ref_policy()` for what to do with references.
>
> Then when constructing the `G1FullCollector` we can use this to set what "compaction level" we should use. I think a good place to store this would be in the `G1FullGCScope`.
Thanks Stefan!
-------------
PR: https://git.openjdk.java.net/jdk/pull/2760
More information about the hotspot-gc-dev
mailing list