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

Thomas Schatzl tschatzl at openjdk.org
Tue Sep 23 08:18:15 UTC 2025


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

>> src/hotspot/share/gc/g1/g1PeriodicGCTask.cpp line 61:
>> 
>>> 59:       G1PeriodicGCInterval = 0;
>>> 60:       log_warning(gc, periodic)("System loadavg not supported. Periodic GC is disabled "
>>> 61:                                 "by setting G1PeriodicGCInterval to 0.");
>> 
>> This disables periodic-gc. It's not super obvious that this is desirable. My expectation would be if `G1PeriodicGCSystemLoadThreshold`, a fine tuning knob in controlling periodic-gc, is not supported, this tuning knob will just be ignored with a warning, instead of disabling periodic-gc completely.
>> 
>> However, I can also imagine starting periodic-gc when system-load is high can be detrimental, so disabling periodic-gc is safer.
>> 
>> (Just raising it for discussion.)
>
> 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.

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

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


More information about the hotspot-gc-dev mailing list