RFR: 8048180: Eager reclaim of humongous objects with references [v3]

Ivan Walulya iwalulya at openjdk.org
Thu Oct 9 11:52:04 UTC 2025


On Wed, 8 Oct 2025 16:12:20 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Hi all,
>> 
>>   please review this change to G1 that enables eager reclaim of humongous objects with references, either objArrays or just really large objects.
>> 
>> It works the same as other humongous object's eager reclaim, with the caveat that I disabled it during concurrent mark to avoid problems with SATB. There is fairly extensive documentation about why I think this works, and how in the comment in `g1YoungCollector.cpp`.
>> 
>> The test case exhaustively tests all combinations of when a particular type of object should be able to be reclaimed depending on when it is allocated (only for `typeArray` and `objArray` - huge objects work the same as the latter).
>> 
>> I added a diagnostic flag `G1EagerReclaimWithRefs` to allow disabling this particular functionality for diagnostic purposes, but I think it's not really necessary, and I'm open to remove it.
>> 
>> The following screenshot shows pause times before (purple) and after (brown) of one of the [Optaplanner](https://www.optaplanner.org/blog/2021/09/15/HowMuchFasterIsJava17.html) benchmarks as a result of this change.
>>  
>> <img width="702" height="485" alt="Screenshot 2025-09-26 at 13 59 05" src="https://github.com/user-attachments/assets/995e9e27-f861-44bd-8ced-3bd952e314e8" />
>> 
>> Testing: new test cases, gha, tier1-5
>> 
>> Thanks,
>>   Thomas
>
> Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:
> 
>   * more documentation work

LGTM!

Nit:

src/hotspot/share/gc/g1/g1_globals.hpp line 299:

> 297:           "for eager reclaim. Will be selected ergonomically by default.")  \
> 298:                                                                             \
> 299:   product(bool, G1EagerReclaimWithRefs, true, DIAGNOSTIC,                   \

Is there any compelling use case where turning this off would be a good option? Otherwise, I suggest we don't add it.

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

Marked as reviewed by iwalulya (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/27525#pullrequestreview-3318583105
PR Review Comment: https://git.openjdk.org/jdk/pull/27525#discussion_r2416522712


More information about the hotspot-gc-dev mailing list