RFR: 8338977: Parallel: Improve heap resizing heuristics [v17]

Albert Mingkun Yang ayang at openjdk.org
Mon Jun 30 10:17:12 UTC 2025


On Mon, 30 Jun 2025 09:29:28 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

>> Albert Mingkun Yang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 25 commits:
>> 
>>  - Merge branch 'master' into pgc-size-policy
>>  - review
>>  - cast
>>  - remove-young-resize-after-full-gc
>>  - Merge branch 'master' into pgc-size-policy
>>  - Merge branch 'master' into pgc-size-policy
>>  - review
>>  - Merge branch 'master' into pgc-size-policy
>>  - merge
>>  - version
>>  - ... and 15 more: https://git.openjdk.org/jdk/compare/20e0055e...eeda1eb8
>
> src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp line 425:
> 
>> 423:   }
>> 424: 
>> 425:   if (check_gc_overhead_limit()) {
> 
> What is the effect of calling this method twice? Line 400 above, and then again here on line 425. Does that increment `_gc_overhead_counter` twice? More reason why i think the name is confusing.

This method checks after-gc gc-ratio and memory limit, so it is meant to be called after every (young/old) gc. (Increment `_gc_overhead_counter` is an impl detail, that is not visible at this abstraction level, IMO.)

> src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp line 756:
> 
>> 754: }
>> 755: 
>> 756: static size_t calculate_free_from_free_ratio_flag(size_t live, uintx free_percent) {
> 
> Why refer to the `free_ratio_flag` instead of just `calculate_free_from_free_percent`?

It's mostly due to how the cmdline flag is named. See one of the callsite: `calculate_free_from_free_ratio_flag(old_gen_live_size, MinHeapFreeRatio);`.

I think this method can be renamed after the cmdline flag is renamed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25000#discussion_r2174707957
PR Review Comment: https://git.openjdk.org/jdk/pull/25000#discussion_r2174709739


More information about the hotspot-gc-dev mailing list