RFR: 8238687: Investigate memory uncommit during young collections in G1 [v6]

Ivan Walulya iwalulya at openjdk.org
Mon Jun 30 12:38:26 UTC 2025


On Mon, 30 Jun 2025 11:47:57 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Ivan Walulya has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Thomas Review
>
> src/hotspot/share/gc/g1/g1_globals.hpp line 177:
> 
>> 175:           range(0, 100)                                                     \
>> 176:                                                                             \
>> 177:   product(uint, G1CPUUsageExpandThreshold, 4, DIAGNOSTIC,                   \
> 
> This, and `G1CPUUsageShrinkThreshold` need to have a range attached to it - if it is set to `0`, I think expansion won't work well initially.
> 
> E.g. if set to 0, `_gc_cpu_usage_deviation_counter` will be initialized to 1, and since we compare with `==` in the code
> 
> 
>   if ((_gc_cpu_usage_deviation_counter == (int)G1CPUUsageExpandThreshold) ||
>       (use_long_term_delta && (long_term_gc_cpu_usage > upper_threshold))) {
> 
> 
> the first term will not fire. Also, we increment `_gc_cpu_usage_deviation_counter` first, then compare.
> 
> So a `range(1, MAX_UINT)` should be added to both. Or make the comparison a `>=` or `<=` (for the shrinking).

Resolved by improving the constraint function and also changing the comparisons to `G1CPUUsageExpandThreshold` and `G1CPUUsageShrinkThreshold`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25832#discussion_r2174970288


More information about the hotspot-gc-dev mailing list