RFR: 8357445: G1: Time-Based Heap Uncommit During Idle Periods [v7]
Thomas Schatzl
tschatzl at openjdk.org
Tue Sep 2 10:10:02 UTC 2025
On Wed, 27 Aug 2025 11:53:17 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
>> src/hotspot/share/gc/g1/g1HeapRegion.cpp line 253:
>>
>>> 251: _age_index(G1SurvRateGroup::InvalidAgeIndex),
>>> 252: _node_index(G1NUMA::UnknownNodeIndex),
>>> 253: _last_access_timestamp(Ticks::now()), // Initialize timestamp with current time
>>
>> Since `G1HeapRegion::initialize()` is called on this region just a bit later, I recommend not wasting the time to call `Ticks::now()` for no gain. Just initialize to a high value(?) and things should work out I think if the code ever comes across such a badly initialized method.
>
> Fwiw, to avoid startup delays (calling `Ticks::now()` on thousands of regions is expensive - I did not test, but it seems reasonable and should be measured), it might be useful to do that initialization lazily (first time the background thread executes).
There is potentially the same issue about calling `Ticks::now()` for thousands of freed regions during GC.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26240#discussion_r2303716836
More information about the hotspot-gc-dev
mailing list