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

Kim Barrett kbarrett at openjdk.org
Mon May 19 08:14:54 UTC 2025


On Mon, 19 May 2025 06:49:57 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Simple removing unnecessary loop in "caller" of `VM_G1CollectFull`, because full-gc always run-to-completion.
> 
> Test: tier1-3

Changes requested by kbarrett (Reviewer).

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.

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

PR Review: https://git.openjdk.org/jdk/pull/25296#pullrequestreview-2849834613
PR Review Comment: https://git.openjdk.org/jdk/pull/25296#discussion_r2095115204


More information about the hotspot-gc-dev mailing list