Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,13 @@ JVMFlag::Error NUMAInterleaveGranularityConstraintFunc(size_t value, bool verbos

return JVMFlag::SUCCESS;
}

JVMFlag::Error LargePageSizeInBytesConstraintFunc(size_t value, bool verbose) {
if (!is_power_of_2(value)) {
JVMFlag::printError(verbose, "LargePageSizeInBytes ( %zu ) must be "
"a power of 2\n",
value);
return JVMFlag::VIOLATES_CONSTRAINT;
}
return JVMFlag::SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
f(intx, ContendedPaddingWidthConstraintFunc) \
f(intx, PerfDataSamplingIntervalFunc) \
f(uintx, VMPageSizeConstraintFunc) \
f(size_t, NUMAInterleaveGranularityConstraintFunc)
f(size_t, NUMAInterleaveGranularityConstraintFunc) \
f(size_t, LargePageSizeInBytesConstraintFunc)

RUNTIME_CONSTRAINTS(DECLARE_CONSTRAINT)

Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/runtime/globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,10 @@ const int ObjectAlignmentInBytes = 8;
\
product(size_t, LargePageSizeInBytes, 0, \
"Maximum large page size used (0 will use the default large " \
"page size for the environment as the maximum)") \
"page size for the environment as the maximum) " \
"(must be a power of 2)") \
range(0, max_uintx) \
constraint(LargePageSizeInBytesConstraintFunc, AtParse) \
\
product(size_t, LargePageHeapSizeThreshold, 128*M, \
"Use large pages if maximum heap is at least this big") \
Expand Down
6 changes: 3 additions & 3 deletions test/lib-test/jdk/test/whitebox/vm_flags/SizeTTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* ANY WARRANTY; without even the implied warranty of MERCHANTABILTY or
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this was changed by mistake. Otherwise, the backport LGTM.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. Thanks for the review.

* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
Expand Down Expand Up @@ -35,7 +35,7 @@
import jdk.test.lib.Platform;

public class SizeTTest {
private static final String FLAG_NAME = "ArrayAllocatorMallocLimit";
private static final String FLAG_NAME = "LargePageHeapSizeThreshold";
private static final Long[] TESTS = {0L, 100L, (long) Integer.MAX_VALUE,
(1L << 32L) - 1L, 1L << 32L};
private static final Long[] EXPECTED_64 = TESTS;
Expand Down