From 1a5a09bfdfd430d2546af8048c028a326a9c7d2d Mon Sep 17 00:00:00 2001 From: Rui Li Date: Fri, 7 Nov 2025 06:59:17 +0000 Subject: [PATCH 1/3] 8371381: [Shenandoah] Setting ergo flags should use FLAG_SET_ERGO --- .../share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp | 6 +++--- src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp index 6e3062d158f0b..b6e491754fe61 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp @@ -36,7 +36,7 @@ do { \ if (FLAG_IS_DEFAULT(name) && (name)) { \ log_info(gc)("Heuristics ergonomically sets -XX:-" #name); \ - FLAG_SET_DEFAULT(name, false); \ + FLAG_SET_ERGO(name, false); \ } \ } while (0) @@ -44,7 +44,7 @@ do { \ if (FLAG_IS_DEFAULT(name) && !(name)) { \ log_info(gc)("Heuristics ergonomically sets -XX:+" #name); \ - FLAG_SET_DEFAULT(name, true); \ + FLAG_SET_ERGO(name, true); \ } \ } while (0) @@ -52,7 +52,7 @@ do { \ if (FLAG_IS_DEFAULT(name)) { \ log_info(gc)("Heuristics ergonomically sets -XX:" #name "=" #value); \ - FLAG_SET_DEFAULT(name, value); \ + FLAG_SET_ERGO(name, value); \ } \ } while (0) diff --git a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp index 8bd59beb93b7a..c9b438f827040 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp @@ -353,7 +353,7 @@ "evacuation collection set (comprised of both young and old " \ "regions) is also bounded by this parameter. In percents of " \ "total (young-generation) heap size.") \ - range(1,100) \ + range(0,100) \ \ product(double, ShenandoahEvacWaste, 1.2, EXPERIMENTAL, \ "How much waste evacuations produce within the reserved space. " \ From 65fc987842fa88eabe00f37e2f6bb7bb6e1fb819 Mon Sep 17 00:00:00 2001 From: Rui Li Date: Wed, 12 Nov 2025 00:17:18 +0000 Subject: [PATCH 2/3] Use FLAG_SET_DEFAULT for ShenandoahEvacReserve in passive --- .../share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp | 6 +++--- .../share/gc/shenandoah/mode/shenandoahPassiveMode.cpp | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp index b6e491754fe61..3cd2cb1d171dc 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp @@ -36,7 +36,7 @@ do { \ if (FLAG_IS_DEFAULT(name) && (name)) { \ log_info(gc)("Heuristics ergonomically sets -XX:-" #name); \ - FLAG_SET_ERGO(name, false); \ + FLAG_SET_ERGO(name, false); \ } \ } while (0) @@ -44,7 +44,7 @@ do { \ if (FLAG_IS_DEFAULT(name) && !(name)) { \ log_info(gc)("Heuristics ergonomically sets -XX:+" #name); \ - FLAG_SET_ERGO(name, true); \ + FLAG_SET_ERGO(name, true); \ } \ } while (0) @@ -52,7 +52,7 @@ do { \ if (FLAG_IS_DEFAULT(name)) { \ log_info(gc)("Heuristics ergonomically sets -XX:" #name "=" #value); \ - FLAG_SET_ERGO(name, value); \ + FLAG_SET_ERGO(name, value); \ } \ } while (0) diff --git a/src/hotspot/share/gc/shenandoah/mode/shenandoahPassiveMode.cpp b/src/hotspot/share/gc/shenandoah/mode/shenandoahPassiveMode.cpp index 4c0bc209d78d6..41b2703730bdd 100644 --- a/src/hotspot/share/gc/shenandoah/mode/shenandoahPassiveMode.cpp +++ b/src/hotspot/share/gc/shenandoah/mode/shenandoahPassiveMode.cpp @@ -29,6 +29,7 @@ #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "logging/log.hpp" #include "logging/logTag.hpp" +#include "runtime/globals_extension.hpp" #include "runtime/java.hpp" void ShenandoahPassiveMode::initialize_flags() const { @@ -38,7 +39,10 @@ void ShenandoahPassiveMode::initialize_flags() const { // No need for evacuation reserve with Full GC, only for Degenerated GC. if (!ShenandoahDegeneratedGC) { - SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahEvacReserve, 0); + if (FLAG_IS_DEFAULT(ShenandoahEvacReserve)) { + log_info(gc)("Heuristics sets -XX:ShenandoahEvacReserve=0"); + FLAG_SET_DEFAULT(ShenandoahEvacReserve, 0); + } } // Disable known barriers by default. From 6200456b7130997d227dd5a128e4cefbd05059b5 Mon Sep 17 00:00:00 2001 From: Rui Li Date: Wed, 12 Nov 2025 19:29:04 +0000 Subject: [PATCH 3/3] Move ShenandoahEvacReserve back to (1,100) --- src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp index c9b438f827040..8bd59beb93b7a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp @@ -353,7 +353,7 @@ "evacuation collection set (comprised of both young and old " \ "regions) is also bounded by this parameter. In percents of " \ "total (young-generation) heap size.") \ - range(0,100) \ + range(1,100) \ \ product(double, ShenandoahEvacWaste, 1.2, EXPERIMENTAL, \ "How much waste evacuations produce within the reserved space. " \