RFR: 8357218: G1: Remove loop in G1CollectedHeap::try_collect_fullgc
Albert Mingkun Yang
ayang at openjdk.org
Mon May 19 08:27:55 UTC 2025
On Mon, 19 May 2025 08:12:26 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Simple removing unnecessary loop in "caller" of `VM_G1CollectFull`, because an explicit full-gc always run-to-completion.
>>
>> Test: tier1-3
>
> src/hotspot/share/gc/g1/g1CollectedHeap.cpp line 1875:
>
>> 1873: // Request is trivially finished.
>> 1874: if (!GCCause::is_explicit_full_gc(cause) || op.gc_succeeded()) {
>> 1875: return op.gc_succeeded();
>
> Complete removal of this part isn't correct. The premise of this change, that "full-gc always
> run-to-completion" is not correct. A `_g1_periodic_collection` may be cancelled:
> https://github.com/openjdk/jdk/blob/50a7c61d28b9885ff48f4fcd8bfd460b507bbcef/src/hotspot/share/gc/g1/g1VMOperations.cpp#L39-L48
> Such a collection is not an explicit full-gc, so that part of the test may be true, when this function
> returns false because the gc did not succeed.
Updated the description. The overall result of `!GCCause::is_explicit_full_gc(cause) || op.gc_succeeded()` is always true.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25296#discussion_r2095139330
More information about the hotspot-gc-dev
mailing list