Integrated: 8368089: G1: G1PeriodicGCTask::should_start_periodic_gc may use uninitialised value if os::loadavg is unsupported

Guanqiang Han ghan at openjdk.org
Thu Sep 25 11:58:33 UTC 2025


On Sun, 21 Sep 2025 23:52:15 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

This pull request has now been integrated.

Changeset: 52e55046
Author:    Guanqiang Han <ghan at openjdk.org>
Committer: Ivan Walulya <iwalulya at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/52e550462798c568a8a5457af2f9554fd784cd8a
Stats:     11 lines in 1 file changed: 6 ins; 0 del; 5 mod

8368089: G1: G1PeriodicGCTask::should_start_periodic_gc may use uninitialised value if os::loadavg is unsupported

Reviewed-by: ayang, tschatzl, iwalulya

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

PR: https://git.openjdk.org/jdk/pull/27413


More information about the hotspot-gc-dev mailing list