RFR: 8357218: G1: Remove loop in G1CollectedHeap::try_collect_fullgc

Thomas Schatzl tschatzl at openjdk.org
Mon May 19 12:08:55 UTC 2025


On Mon, 19 May 2025 08:25:02 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> 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.

(Somehow comments seem to have disappeared, probably my fault. anyway:)

This method returns `false` if the VM op has not been executed (skipped). The new code always returns `true`, which is wrong afaict.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25296#discussion_r2095561063


More information about the hotspot-gc-dev mailing list