8262326: MaxMetaspaceSize does not have to be aligned to metaspace commit alignment
Reviewed-by: coleenp, iklam
diff --git a/src/hotspot/share/memory/metaspace.cpp b/src/hotspot/share/memory/metaspace.cpp
index 87a0e57..965b395 100644
--- a/src/hotspot/share/memory/metaspace.cpp
+++ b/src/hotspot/share/memory/metaspace.cpp
@@ -607,9 +607,8 @@
// to commit for the Metaspace.
// It is just a number; a limit we compare against before committing. It
// does not have to be aligned to anything.
- // It gets used as compare value in class CommitLimiter.
- // It is set to max_uintx in globals.hpp by default, so by default it does
- // not limit anything.
+ // It gets used as compare value before attempting to increase the metaspace
+ // commit charge. It defaults to max_uintx (unlimited).
//
// CompressedClassSpaceSize is the size, in bytes, of the address range we
// pre-reserve for the compressed class space (if we use class space).
@@ -626,8 +625,7 @@
// We still adjust CompressedClassSpaceSize to reasonable limits, mainly to
// save on reserved space, and to make ergnonomics less confusing.
- // (aligned just for cleanliness:)
- MaxMetaspaceSize = MAX2(align_down(MaxMetaspaceSize, commit_alignment()), commit_alignment());
+ MaxMetaspaceSize = MAX2(MaxMetaspaceSize, commit_alignment());
if (UseCompressedClassPointers) {
// Let CCS size not be larger than 80% of MaxMetaspaceSize. Note that is
diff --git a/src/hotspot/share/memory/metaspace/metaspaceReporter.cpp b/src/hotspot/share/memory/metaspace/metaspaceReporter.cpp
index f055f78..1a69eb6 100644
--- a/src/hotspot/share/memory/metaspace/metaspaceReporter.cpp
+++ b/src/hotspot/share/memory/metaspace/metaspaceReporter.cpp
@@ -96,10 +96,7 @@
static void print_settings(outputStream* out, size_t scale) {
out->print("MaxMetaspaceSize: ");
- // See Metaspace::ergo_initialize() for how MaxMetaspaceSize is rounded
- if (MaxMetaspaceSize >= align_down(max_uintx, Metaspace::commit_alignment())) {
- // aka "very big". Default is max_uintx, but due to rounding in arg parsing the real
- // value is smaller.
+ if (MaxMetaspaceSize == max_uintx) {
out->print("unlimited");
} else {
print_human_readable_size(out, MaxMetaspaceSize, scale);