RFR: 8366781: Parallel: Include OS free memory in GC selection heuristics [v5]

Ivan Walulya iwalulya at openjdk.org
Fri Oct 24 14:36:47 UTC 2025


On Tue, 21 Oct 2025 09:31:32 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> Add a new condition checking if OS has enough free memory to commit/expand old-gen, which determines whether the upcoming GC should be young or full.
>> 
>> This is needed only when `UseAdaptiveSizePolicy` is on, because this is intended to avoid including extra OS-time in gc-pause-time tracking, used for young-gen resizing.
>> 
>> Test: tier1-3
>
> Albert Mingkun Yang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 10 additional commits since the last revision:
> 
>  - review
>  - Merge branch 'master' into pgc-os-free-mem
>  - Merge branch 'master' into pgc-os-free-mem
>  - review
>  - sizet
>  - Merge branch 'master' into pgc-os-free-mem
>  - Merge branch 'master' into pgc-os-free-mem
>  - review
>  - Merge branch 'master' into pgc-os-free-mem
>  - pgc-os-free-mem

Nit:

src/hotspot/share/gc/parallel/psScavenge.cpp line 562:

> 560:     uint64_t free_mem_in_os;
> 561:     if (os::free_memory(free_mem_in_os)) {
> 562:       size_t actual_free = (size_t)MIN2(old_gen->committed().byte_size() - old_gen->used_in_bytes() + free_mem_in_os,

Suggestion:

      uint64_t actual_free = old_gen->committed().byte_size() - old_gen->used_in_bytes() + free_mem_in_os;


with associated changes to the log, probably would have been easier to read

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

Marked as reviewed by iwalulya (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/27068#pullrequestreview-3377196960
PR Review Comment: https://git.openjdk.org/jdk/pull/27068#discussion_r2460791524


More information about the hotspot-gc-dev mailing list