Skip to content

Commit

Permalink
8262326: MaxMetaspaceSize does not have to be aligned to metaspace co…
Browse files Browse the repository at this point in the history
…mmit alignment

Reviewed-by: coleenp, iklam
  • Loading branch information
tstuefe committed Mar 15, 2021
1 parent d825198 commit 189289d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
8 changes: 3 additions & 5 deletions src/hotspot/share/memory/metaspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,8 @@ void Metaspace::ergo_initialize() {
// 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).
Expand All @@ -626,8 +625,7 @@ void Metaspace::ergo_initialize() {
// 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
Expand Down
5 changes: 1 addition & 4 deletions src/hotspot/share/memory/metaspace/metaspaceReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@ static void print_vs(outputStream* out, size_t scale) {

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);
Expand Down

1 comment on commit 189289d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.