8232051: Epsilon should warn about Xms/Xmx/AlwaysPreTouch configuration
authorshade
Tue, 15 Oct 2019 19:45:09 +0200
changeset 58605 10db6989907f
parent 58604 791217cdc433
child 58609 fbfc72ec8e6b
8232051: Epsilon should warn about Xms/Xmx/AlwaysPreTouch configuration Reviewed-by: zgu
src/hotspot/share/gc/epsilon/epsilonArguments.cpp
test/hotspot/jtreg/gc/epsilon/TestAlwaysPretouch.java
--- a/src/hotspot/share/gc/epsilon/epsilonArguments.cpp	Tue Oct 15 19:38:59 2019 +0200
+++ b/src/hotspot/share/gc/epsilon/epsilonArguments.cpp	Tue Oct 15 19:45:09 2019 +0200
@@ -45,13 +45,25 @@
     FLAG_SET_DEFAULT(ExitOnOutOfMemoryError, true);
   }
 
+  // Warn users that non-resizable heap might be better for some configurations.
+  // We are not adjusting the heap size by ourselves, because it affects startup time.
+  if (InitialHeapSize != MaxHeapSize) {
+    log_warning(gc)("Consider setting -Xms equal to -Xmx to avoid resizing hiccups");
+  }
+
+  // Warn users that AlwaysPreTouch might be better for some configurations.
+  // We are not turning this on by ourselves, because it affects startup time.
+  if (FLAG_IS_DEFAULT(AlwaysPreTouch) && !AlwaysPreTouch) {
+    log_warning(gc)("Consider enabling -XX:+AlwaysPreTouch to avoid memory commit hiccups");
+  }
+
   if (EpsilonMaxTLABSize < MinTLABSize) {
-    warning("EpsilonMaxTLABSize < MinTLABSize, adjusting it to " SIZE_FORMAT, MinTLABSize);
+    log_warning(gc)("EpsilonMaxTLABSize < MinTLABSize, adjusting it to " SIZE_FORMAT, MinTLABSize);
     EpsilonMaxTLABSize = MinTLABSize;
   }
 
   if (!EpsilonElasticTLAB && EpsilonElasticTLABDecay) {
-    warning("Disabling EpsilonElasticTLABDecay because EpsilonElasticTLAB is disabled");
+    log_warning(gc)("Disabling EpsilonElasticTLABDecay because EpsilonElasticTLAB is disabled");
     FLAG_SET_DEFAULT(EpsilonElasticTLABDecay, false);
   }
 
--- a/test/hotspot/jtreg/gc/epsilon/TestAlwaysPretouch.java	Tue Oct 15 19:38:59 2019 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestAlwaysPretouch.java	Tue Oct 15 19:45:09 2019 +0200
@@ -26,7 +26,12 @@
  * @key gc
  * @requires vm.gc.Epsilon & !vm.graal.enabled
  * @summary Basic sanity test for Epsilon
- * @run main/othervm -Xmx1g -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch
+ * @run main/othervm -Xms128m -Xmx1g                     -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch
+ * @run main/othervm -Xms128m -Xmx1g -XX:-AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch
+ * @run main/othervm -Xms128m -Xmx1g -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch
+ * @run main/othervm          -Xmx1g                     -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch
+ * @run main/othervm          -Xmx1g -XX:-AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch
+ * @run main/othervm          -Xmx1g -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch
  */
 
 package gc.epsilon;