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

Ivan Walulya iwalulya at openjdk.org
Tue Jun 24 17:38:31 UTC 2025


On Tue, 24 Jun 2025 15:49:56 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Ivan Walulya has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Albert suggestions
>
> src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp line 231:
> 
>> 229:   const double min_gc_time_ratio_ratio = G1MinimumPercentOfGCTimeRatio / 100.0;
>> 230:   double upper_threshold = pause_time_threshold * (1 + min_gc_time_ratio_ratio);
>> 231:   double lower_threshold = pause_time_threshold * (1 - min_gc_time_ratio_ratio);
> 
> There are some inconsistencies naming variables in this change: we use `pause_time_threshold`, `pause_time_ratio` and other similar terms that are under(de)fined for, essentially, (parts of) the cpu resources that G1 uses.
> 
> Also some things are called "ratio", but are percentages (e.g. `G1MinimumPercentOfGCTimeRatio`), and the comments somewhat interchangeably use cpu usage (in percent) and gctimeratio (the inverse of cpu usage).
> 
> I think it is useful to clean this up, also looking forward to making G1 start using actual GC CPU usage (thread user times), e.g.
> 
> 
> pause_time_threshold -> gc_cpu_usage_threshold
> long_term_pause_time_ratio -> long_term_cpu_usage
> [and so on]
> 
> 
> I admit that right now `cpu_usage` might be slightly misleading because we only approximate it using pause times and total run times (which do not necessarily reflect actual cpu usage), but it seems good enough for now, and future changes (https://bugs.openjdk.org/browse/JDK-8359348; even with that we might need to fallback to current mechanism).
> 
> What do others think?

Sounds good to me, I may suggest naming it as a `gc_cpu_usage_target` or `target_gc_cpu_usage` then it is easier to reason about the deviations from the target in the model.

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

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


More information about the hotspot-dev mailing list