RFR: 8368089: G1: G1PeriodicGCTask::should_start_periodic_gc may use uninitialised value if os::loadavg is unsupported [v5]
duke
duke at openjdk.org
Thu Sep 25 11:19:26 UTC 2025
On Wed, 24 Sep 2025 14:50:23 GMT, Guanqiang Han <ghan at openjdk.org> wrote:
>> Please review this change. Thanks!
>>
>> **Description:**
>>
>> Previously the check combined loadavg() failure and threshold comparison in a single condition. When os::loadavg() returned -1, `recent_load` contained an undefined value but was still logged as if it was a real load average, leading to misleading log output.
>>
>> **Fix:**
>>
>> This change separates the failure case from the combined check:
>> - If os::loadavg() returns -1, log "System loadavg not supported" and skip.
>> - Only compare `recent_load` to the threshold when loadavg() succeeds.
>>
>> **Test:**
>>
>> GHA
>
> Guanqiang Han has updated the pull request incrementally with one additional commit since the last revision:
>
> Update g1PeriodicGCTask.cpp
>
> The periodic gc would be started the first time after detecting that loadavg is not supported.
@hgqxjj
Your change (at version 9a3f6d42f93bd03d80b8a857314c26eb9f40e253) is now ready to be sponsored by a Committer.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27413#issuecomment-3333457495
More information about the hotspot-gc-dev
mailing list