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

Guanqiang Han ghan at openjdk.org
Tue Sep 23 08:35:24 UTC 2025


On Tue, 23 Sep 2025 08:15:10 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> With "disable this functionality" I actually meant disabling the `G1PeriodicGCSystemLoadThreshold` check, but not completely disabling periodic GCs. The reason is that I do not think the impact will be that high. At least when choosing concurrent GC as the choice for getting back memory.
>
> In case of full gcs having been selected, that will have a large performance impact, it may be better to terminate the VM for safety?
> 
> Not sure. To me periodic full gcs seem to be such a rare use case that it could be ignored for the sake of not making this rule too complicated.

Actually, my change was following the intent of the original author: if os::loadavg() is not supported, we return early to prevent periodic GC from triggering when the system load is uncertain. This is indeed a conservative choice.

However, I can also agree with the suggestion to only disable the G1PeriodicGCSystemLoadThreshold check (i.e., set it to 0) while leaving periodic GC itself active.

I would like to hear your thoughts on which approach would be preferable.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27413#discussion_r2371572753


More information about the hotspot-gc-dev mailing list