From 6b1144679766b1d8a11aee2013fbc3b6ee10cabf Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Tue, 15 Oct 2019 19:45:09 +0200 Subject: [PATCH] 8232051: Epsilon should warn about Xms/Xmx/AlwaysPreTouch configuration Reviewed-by: zgu --- .../share/gc/epsilon/epsilonArguments.cpp | 16 ++++++++++++++-- .../jtreg/gc/epsilon/TestAlwaysPretouch.java | 7 ++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/gc/epsilon/epsilonArguments.cpp b/src/hotspot/share/gc/epsilon/epsilonArguments.cpp index ea2c036e289..6bbc88e019b 100644 --- a/src/hotspot/share/gc/epsilon/epsilonArguments.cpp +++ b/src/hotspot/share/gc/epsilon/epsilonArguments.cpp @@ -45,13 +45,25 @@ void EpsilonArguments::initialize() { 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); } diff --git a/test/hotspot/jtreg/gc/epsilon/TestAlwaysPretouch.java b/test/hotspot/jtreg/gc/epsilon/TestAlwaysPretouch.java index fc070cd3ce2..2c44c31d80b 100644 --- a/test/hotspot/jtreg/gc/epsilon/TestAlwaysPretouch.java +++ b/test/hotspot/jtreg/gc/epsilon/TestAlwaysPretouch.java @@ -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;