8227106: Rename InitiatingHeapOccupancyPercent to G1IHOP and make G1IHOP G1 specific

Reviewed-by: ayang, tschatzl, iwalulya
This commit is contained in:
Leo Korinth 2026-05-07 09:51:41 +00:00
parent af9ed6c022
commit c2b9ffed49
20 changed files with 65 additions and 45 deletions

View File

@ -1006,7 +1006,7 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar
G1IHOPControl* G1Policy::create_ihop_control(const G1OldGenAllocationTracker* old_gen_alloc_tracker,
const G1Predictions* predictor) {
return new G1IHOPControl(InitiatingHeapOccupancyPercent,
return new G1IHOPControl(G1IHOP,
old_gen_alloc_tracker,
G1UseAdaptiveIHOP,
predictor,

View File

@ -100,9 +100,8 @@
\
product(bool, G1UseAdaptiveIHOP, true, \
"Adaptively adjust the initiating heap occupancy from the " \
"initial value of InitiatingHeapOccupancyPercent. The policy " \
"attempts to start marking in time based on application " \
"behavior.") \
"initial value of G1IHOP. The policy attempts to start marking " \
"in time based on application behavior.") \
\
product(size_t, G1AdaptiveIHOPNumInitialSamples, 3, EXPERIMENTAL, \
"How many completed time periods from concurrent start to first " \
@ -110,6 +109,19 @@
"of the optimal occupancy to start marking.") \
range(1, max_intx) \
\
product(uint, G1IHOP, 45, \
"The Initiating Heap Occupancy Percentage (IHOP) for the " \
"concurrent cycle. G1IHOP sets the percentage of the current " \
"Java heap capacity occupied by the old generation at which G1 " \
"starts this process. If G1UseAdaptiveIHOP is enabled, this " \
"value is used as the initial threshold and may be adjusted " \
"ergonomically by G1. " \
"A value of 0 will result in as frequent as possible concurrent " \
"cycles. A value of 100 disables concurrent cycles. " \
"Fragmentation waste in the old generation is not considered " \
"free space in this calculation.") \
range(0, 100) \
\
product(uint, G1ConfidencePercent, 50, \
"Confidence level for MMU/pause predictions. A higher value " \
"means that G1 will use less safety margin for its predictions.") \

View File

@ -534,6 +534,7 @@ static SpecialFlag const special_jvm_flags[] = {
{ "UseSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
// --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
{ "CreateMinidumpOnCrash", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
{ "InitiatingHeapOccupancyPercent", JDK_Version::jdk(27), JDK_Version::jdk(28), JDK_Version::jdk(29) },
// -------------- Obsolete Flags - sorted by expired_in --------------
@ -582,6 +583,7 @@ typedef struct {
static AliasedFlag const aliased_jvm_flags[] = {
{ "CreateMinidumpOnCrash", "CreateCoredumpOnCrash" },
G1GC_ONLY({"InitiatingHeapOccupancyPercent" COMMA "G1IHOP" } COMMA)
{ nullptr, nullptr}
};

View File

@ -2350,11 +2350,11 @@ Java HotSpot VM.
option is disabled by default and can be enabled only with the `-XX:+UseG1GC` option.
[`-XX:G1AdaptiveIHOPNumInitialSamples=`]{#-XX_G1AdaptiveIHOPNumInitialSamples}*number*
: When `-XX:UseAdaptiveIHOP` is enabled, this option sets the number of
completed marking cycles used to gather samples until G1 adaptively
determines the optimum value of `-XX:InitiatingHeapOccupancyPercent`. Before,
G1 uses the value of `-XX:InitiatingHeapOccupancyPercent` directly for
this purpose. The default value is 3.
: When `-XX:UseAdaptiveIHOP` is enabled, this option sets the number
of completed concurrent cycles used to gather samples until G1
adaptively determines the optimum value of `-XX:G1IHOP`. Before,
G1 uses the value of `-XX:G1IHOP` directly for this purpose. The
default value is 3.
[`-XX:G1HeapRegionSize=`]{#-XX_G1HeapRegionSize}*size*
: Sets the size of the regions into which the Java heap is subdivided when
@ -2416,15 +2416,14 @@ Java HotSpot VM.
> `-XX:G1ReservePercent=20`
[`-XX:+G1UseAdaptiveIHOP`]{#-XX__G1UseAdaptiveIHOP}
: Controls adaptive calculation of the old generation occupancy to start
background work preparing for an old generation collection. If enabled,
G1 uses `-XX:InitiatingHeapOccupancyPercent` for the first few times as
specified by the value of `-XX:G1AdaptiveIHOPNumInitialSamples`, and after
that adaptively calculates a new optimum value for the initiating
occupancy automatically.
Otherwise, the old generation collection process always starts at the
old generation occupancy determined by
`-XX:InitiatingHeapOccupancyPercent`.
: Controls adaptive calculation of the old generation occupancy to
start background work preparing for an old generation collection.
If enabled, G1 uses `-XX:G1IHOP` for the first few times as
specified by the value of `-XX:G1AdaptiveIHOPNumInitialSamples`,
and after that adaptively calculates a new optimum value for the
initiating occupancy automatically. Otherwise, the old generation
collection process always starts at the old generation occupancy
determined by `-XX:G1IHOP`.
The default is enabled.
@ -2491,7 +2490,7 @@ Java HotSpot VM.
> `-XX:InitialSurvivorRatio=4`
[`-XX:InitiatingHeapOccupancyPercent=`]{#-XX_InitiatingHeapOccupancyPercent}*percent*
[`-XX:G1IHOP=`]{#-XX_G1IHOP}*percent*
: Sets the percentage of the old generation occupancy (0 to 100) at which to
start the first few concurrent marking cycles for the G1 garbage collector.
@ -2504,7 +2503,7 @@ Java HotSpot VM.
The following example shows how to set the initiating heap occupancy to 75%:
> `-XX:InitiatingHeapOccupancyPercent=75`
> `-XX:G1IHOP=75`
[`-XX:MaxGCPauseMillis=`]{#-XX_MaxGCPauseMillis}*time*
: Sets a target for the maximum GC pause time (in milliseconds). This is a

View File

@ -41,9 +41,9 @@ import jdk.test.lib.process.ProcessTools;
public class TestHumongousAllocConcurrentStart {
// Heap sizes < 224 MB are increased to 224 MB if vm_page_size == 64K to
// fulfill alignment constraints.
private static final int heapSize = 224; // MB
private static final int heapRegionSize = 1; // MB
private static final int initiatingHeapOccupancyPercent = 50; // %
private static final int heapSize = 224; // MB
private static final int heapRegionSize = 1; // MB
private static final int G1IHOP = 50; // %
public static void main(String[] args) throws Exception {
OutputAnalyzer output = ProcessTools.executeLimitedTestJava(
@ -51,7 +51,7 @@ public class TestHumongousAllocConcurrentStart {
"-Xms" + heapSize + "m",
"-Xmx" + heapSize + "m",
"-XX:G1HeapRegionSize=" + heapRegionSize + "m",
"-XX:InitiatingHeapOccupancyPercent=" + initiatingHeapOccupancyPercent,
"-XX:G1IHOP=" + G1IHOP,
"-Xlog:gc",
HumongousObjectAllocator.class.getName());
@ -70,7 +70,7 @@ public class TestHumongousAllocConcurrentStart {
// Number of objects to allocate to go above IHOP
final int humongousObjectAllocations =
(int)((heapSize * initiatingHeapOccupancyPercent / 100.0) / heapRegionSize) + 1;
(int)((heapSize * G1IHOP / 100.0) / heapRegionSize) + 1;
// Allocate
for (int i = 1; i <= humongousObjectAllocations; i++) {

View File

@ -115,7 +115,7 @@ public class TestHumongousCodeCacheRoots {
final String[] baseArguments = new String[] {
"-XX:+UseG1GC", "-XX:G1HeapRegionSize=1M", "-Xmx100M", // make sure we get a humongous region
"-XX:+UnlockDiagnosticVMOptions",
"-XX:InitiatingHeapOccupancyPercent=1", // strong code root marking
"-XX:G1IHOP=1", // strong code root marking
"-XX:+G1VerifyHeapRegionCodeRoots", "-XX:+VerifyAfterGC", // make sure that verification is run
};

View File

@ -49,10 +49,10 @@ import java.lang.ref.Reference;
public class TestHumongousConcurrentStartUndo {
// Heap sizes < 224 MB are increased to 224 MB if vm_page_size == 64K to
// fulfill alignment constraints.
private static final int HeapSize = 224; // MB
private static final int HeapRegionSize = 1; // MB
private static final int InitiatingHeapOccupancyPercent = 50; // %
private static final int YoungSize = HeapSize / 8;
private static final int HeapSize = 224; // MB
private static final int HeapRegionSize = 1; // MB
private static final int G1IHOP = 50; // %
private static final int YoungSize = HeapSize / 8;
public static void main(String[] args) throws Exception {
OutputAnalyzer output = ProcessTools.executeLimitedTestJava(
@ -62,7 +62,7 @@ public class TestHumongousConcurrentStartUndo {
"-Xmx" + HeapSize + "m",
"-Xmn" + YoungSize + "m",
"-XX:G1HeapRegionSize=" + HeapRegionSize + "m",
"-XX:InitiatingHeapOccupancyPercent=" + InitiatingHeapOccupancyPercent,
"-XX:G1IHOP=" + G1IHOP,
"-XX:-G1UseAdaptiveIHOP",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",

View File

@ -61,7 +61,7 @@ public class TestPrintRegionRememberedSetInfo {
"-XX:+ExplicitGCInvokesConcurrent",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:G1HeapRegionSize=1M",
"-XX:InitiatingHeapOccupancyPercent=0",
"-XX:G1IHOP=0",
};
finalargs.addAll(Arrays.asList(defaultArgs));

View File

@ -63,7 +63,7 @@ public class TestRemsetLoggingTools {
"-Xms20m",
"-Xmx20m",
"-XX:ParallelGCThreads=1",
"-XX:InitiatingHeapOccupancyPercent=100", // we don't want the additional GCs due to marking
"-XX:G1IHOP=100", // we don't want the additional GCs due to marking
"-XX:+UnlockDiagnosticVMOptions",
"-XX:G1HeapRegionSize=1M",
};

View File

@ -45,13 +45,13 @@ import java.util.List;
*
* @run main/othervm -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
* -Xmx128m -Xms128m
* -XX:G1HeapRegionSize=1M -XX:InitiatingHeapOccupancyPercent=100 -XX:-G1UseAdaptiveIHOP
* -XX:G1HeapRegionSize=1M -XX:G1IHOP=100 -XX:-G1UseAdaptiveIHOP
* -Xlog:gc -Xlog:gc:file=TestHeapCountersRuntime.gc.log
* gc.g1.humongousObjects.TestHeapCounters RUNTIME_COUNTER
*
* @run main/othervm -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
* -Xmx128m -Xms128m
* -XX:G1HeapRegionSize=1M -XX:InitiatingHeapOccupancyPercent=100 -XX:-G1UseAdaptiveIHOP
* -XX:G1HeapRegionSize=1M -XX:G1IHOP=100 -XX:-G1UseAdaptiveIHOP
* -Xlog:gc -Xlog:gc:file=TestHeapCountersMXBean.gc.log
* gc.g1.humongousObjects.TestHeapCounters MX_BEAN_COUNTER
*/

View File

@ -46,7 +46,7 @@ import java.util.stream.Collectors;
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
* -XX:G1HeapRegionSize=1M -Xms200m -Xmx200m -XX:InitiatingHeapOccupancyPercent=100
* -XX:G1HeapRegionSize=1M -Xms200m -Xmx200m -XX:G1IHOP=100
* -Xlog:gc=info:file=TestHumongousMovement.log
* gc.g1.humongousObjects.TestHumongousMovement
*/

View File

@ -45,7 +45,7 @@ import java.lang.ref.WeakReference;
*
* @run main/othervm -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+WhiteBoxAPI -Xbootclasspath/a:. -Xms200m -Xmx200m -Xlog:gc,gc+humongous=debug
* -XX:InitiatingHeapOccupancyPercent=100 -XX:G1HeapRegionSize=1M -Xlog:gc,gc+humongous=debug:file=TestObjectCollected.gc.log
* -XX:G1IHOP=100 -XX:G1HeapRegionSize=1M -Xlog:gc,gc+humongous=debug:file=TestObjectCollected.gc.log
* gc.g1.humongousObjects.TestObjectCollected
*/

View File

@ -71,7 +71,7 @@ public class TestIHOPErgo {
"-Xlog:gc+ihop=debug,gc+ihop+ergo=debug,gc+ergo=debug",
"-XX:+AlwaysTenure",
"-XX:G1AdaptiveIHOPNumInitialSamples=1",
"-XX:InitiatingHeapOccupancyPercent=30"
"-XX:G1IHOP=30"
};
public static void main(String[] args) throws Throwable {

View File

@ -114,13 +114,13 @@ public class TestIHOPStatic {
private static void runTest(int ihop, long pctToFill, long heapSize, boolean expectInitiationMessage) throws Throwable {
System.out.println("");
System.out.println("IHOP test:");
System.out.println(" InitiatingHeapOccupancyPercent : " + ihop);
System.out.println(" G1IHOP : " + ihop);
System.out.println(" Part of heap to fill (percentage) : " + pctToFill);
System.out.println(" MaxHeapSize : " + heapSize);
System.out.println(" Expect for concurrent cycle initiation message : " + expectInitiationMessage);
List<String> options = new ArrayList<>();
Collections.addAll(options,
"-XX:InitiatingHeapOccupancyPercent=" + ihop,
"-XX:G1IHOP=" + ihop,
"-Dmemory.fill=" + (heapSize * 1024 * 1024 * pctToFill / 100),
"-XX:MaxHeapSize=" + heapSize + "M",
"-XX:InitialHeapSize=" + heapSize + "M"

View File

@ -56,7 +56,7 @@ public class TestLogging {
"-XX:+WhiteBoxAPI",
"-Xms10M", "-Xmx10M", "-XX:NewSize=2M", "-XX:MaxNewSize=2M",
"-XX:+AlwaysTenure", // surviving promote objects immediately
"-XX:InitiatingHeapOccupancyPercent=100", // set initial CMC threshold and disable adaptive IHOP
"-XX:G1IHOP=100", // set initial CMC threshold and disable adaptive IHOP
"-XX:-G1UseAdaptiveIHOP", // to avoid additional concurrent cycles caused by ergonomics
"-XX:G1MixedGCCountTarget=4",
"-XX:MaxGCPauseMillis=30000", // to have enough time

View File

@ -41,7 +41,7 @@ import gc.testlibrary.g1.MixedGCProvoker;
* @modules java.management
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -verbose:gc -XX:NewSize=2m -XX:MaxNewSize=2m -Xmx14m -Xms14m -XX:+AlwaysTenure -XX:InitiatingHeapOccupancyPercent=100 -XX:-G1UseAdaptiveIHOP -XX:G1MixedGCCountTarget=4 -XX:MaxGCPauseMillis=30000 -XX:G1HeapRegionSize=1m -XX:G1HeapWastePercent=0 -XX:G1MixedGCLiveThresholdPercent=100 gc.g1.mixedgc.TestOldGenCollectionUsage
* @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -verbose:gc -XX:NewSize=2m -XX:MaxNewSize=2m -Xmx14m -Xms14m -XX:+AlwaysTenure -XX:G1IHOP=100 -XX:-G1UseAdaptiveIHOP -XX:G1MixedGCCountTarget=4 -XX:MaxGCPauseMillis=30000 -XX:G1HeapRegionSize=1m -XX:G1HeapWastePercent=0 -XX:G1MixedGCLiveThresholdPercent=100 gc.g1.mixedgc.TestOldGenCollectionUsage
*/
// 8195115 says that for the "G1 Old Gen" MemoryPool, CollectionUsage.used

View File

@ -70,7 +70,7 @@ public class TestPLABEvacuationFailure {
private static final String[] COMMON_OPTIONS = {
"-Xlog:gc,gc+plab=debug",
"-XX:+UseG1GC",
"-XX:InitiatingHeapOccupancyPercent=100",
"-XX:G1IHOP=100",
"-XX:-G1UseAdaptiveIHOP",
"-XX:G1HeapRegionSize=1m"};

View File

@ -267,6 +267,13 @@ public class TestOptionsWithRanges {
*/
excludeTestMaxRange("CompileThresholdScaling");
/*
* Do not test InitiatingHeapOccupancyPercent as it is an
* alias that will answer with the string G1IHOP. Remove this
* when the alias is removed.
*/
excludeTestRange("InitiatingHeapOccupancyPercent");
List<JVMOption> testSubset = getTestSubset(args);
Asserts.assertGT(testSubset.size(), 0, "Options with ranges not found!");

View File

@ -33,7 +33,7 @@
/*
* The next test stresses the interaction between (mostly) full garbage collections and refinement.
*/
/* @test @key stress randomness @library /vmTestbase /test/lib @run main/othervm -XX:-G1UseAdaptiveIHOP -XX:InitiatingHeapOccupancyPercent=0 -XX:G1HeapRegionSize=1m -XX:G1RSetUpdatingPauseTimePercent=0 -XX:+UnlockDiagnosticVMOptions -XX:G1PerThreadPendingCardThreshold=0 -XX:+VerifyAfterGC -Xlog:gc=debug,gc+refine=debug:gc.log gc.ArrayJuggle.Juggle2 -tg */
/* @test @key stress randomness @library /vmTestbase /test/lib @run main/othervm -XX:-G1UseAdaptiveIHOP -XX:G1IHOP=0 -XX:G1HeapRegionSize=1m -XX:G1RSetUpdatingPauseTimePercent=0 -XX:+UnlockDiagnosticVMOptions -XX:G1PerThreadPendingCardThreshold=0 -XX:+VerifyAfterGC -Xlog:gc=debug,gc+refine=debug:gc.log gc.ArrayJuggle.Juggle2 -tg */
package gc.ArrayJuggle;

View File

@ -29,7 +29,7 @@ package jdk.jfr.event.gc.stacktrace;
*
* @requires vm.gc == "null" | vm.gc == "G1"
* @library /test/lib /test/jdk
* @run main/othervm -XX:+UseG1GC -Xlog:gc* -Xmx64M -XX:InitiatingHeapOccupancyPercent=100
* @run main/othervm -XX:+UseG1GC -Xlog:gc* -Xmx64M -XX:G1IHOP=100
* -XX:FlightRecorderOptions:stackdepth=256
* jdk.jfr.event.gc.stacktrace.TestG1HumongousAllocationPendingStackTrace
*/