Summary
Testing showed that the initial integer type of the G1PeriodicGCSystemLoadThreshold
variable is inappropriate for the use case. The value compared against this threshold value is often a fraction of an integer, which can not be expressed with the existing data type.
Problem
G1PeriodicGCSystemLoadThreshold
is a threshold that is compared to the operating system's load average value.
The operating system's load average is defined as the length of the system run queue averaged over various periods of time. This average is a positive floating point value.
The use of G1PeriodicGCSystemLoadThreshold
is such that if the garbage collector detects that the current system's load average is below this value, it assumes that the system is idle, and can perform some "idle" actions.
Currently G1PeriodicGCSystemLoadThreshold
is an integer, so the user is not able to specify many interesting threshold values (typically values between 0.0 and 1.0, but may be higher) for this use.
Solution
Redefine the type of G1PeriodicGCSystemLoadThreshold as floating point value. This provides the necessary granularity.
Specification
The relevant diff from http://cr.openjdk.java.net/~tschatzl/8215548/webrev/src/hotspot/share/gc/g1/g1_globals.hpp.patch:
--- old/src/hotspot/share/gc/g1/g1_globals.hpp 2018-12-19 15:57:48.905764361 +0100
+++ new/src/hotspot/share/gc/g1/g1_globals.hpp 2018-12-19 15:57:48.452750266 +0100
@@ -311,10 +311,11 @@
"perform a concurrent GC as periodic GC, otherwise use a STW " \
"Full GC.") \
\
- manageable(uintx, G1PeriodicGCSystemLoadThreshold, 0, \
- "Maximum recent system wide system load as returned by the 1m " \
- "value of getloadavg() at which G1 triggers a periodic GC. A " \
- "load above this value cancels a given periodic GC. A value of " \
- "zero disables this check.") \
+ manageable(double, G1PeriodicGCSystemLoadThreshold, 0.0, \
+ "Maximum recent system wide load as returned by the 1m value " \
+ "of getloadavg() at which G1 triggers a periodic GC. A load " \
+ "above this value cancels a given periodic GC. A value of zero " \
+ "disables this check.") \
+ range(0.0, (double)max_uintx) \
- csr of
-
JDK-8215548 G1PeriodicGCSystemLoadThreshold needs to be a double
-
- Resolved
-