RFR: 8366781: Parallel: Include OS free memory in GC selection heuristics [v3]
Guoxiong Li
gli at openjdk.org
Fri Oct 17 14:08:35 UTC 2025
On Wed, 8 Oct 2025 11:56:25 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 six additional commits since the last revision:
>
> - 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
The method `PSScavenge::should_attempt_scavenge` only judges whether it should run young GC. It is not a judgement of the full GC. So I think the literal constants `true` and `false` is better than `SHOULD_RUN_YOUNG_GC` and `SHOULD_RUN_FULL_GC`.
src/hotspot/share/gc/parallel/psScavenge.cpp line 525:
> 523: bool PSScavenge::should_attempt_scavenge() {
> 524: const static bool SHOULD_RUN_YOUNG_GC = true;
> 525: const static bool SHOULD_RUN_FULL_GC = false;
These two constants `SHOULD_RUN_YOUNG_GC` and `SHOULD_RUN_FULL_GC` do not seem to be `static`.
-------------
PR Review: https://git.openjdk.org/jdk/pull/27068#pullrequestreview-3350430158
PR Review Comment: https://git.openjdk.org/jdk/pull/27068#discussion_r2440074208
More information about the hotspot-gc-dev
mailing list