RFR: 8368089: G1: G1PeriodicGCTask::should_start_periodic_gc may use uninitialised value if os::loadavg is unsupported [v3]

Guanqiang Han ghan at openjdk.org
Wed Sep 24 01:11:40 UTC 2025


> 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
  
  Only disable G1PeriodicGCSystemLoadThreshold check when system loadavg not support

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/27413/files
  - new: https://git.openjdk.org/jdk/pull/27413/files/4ff7567c..fcaa92ca

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=27413&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27413&range=01-02

  Stats: 4 lines in 1 file changed: 0 ins; 1 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/27413.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27413/head:pull/27413

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


More information about the hotspot-gc-dev mailing list