Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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 @@ -147,3 +147,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 @@ -42,7 +42,8 @@
f(int, ContendedPaddingWidthConstraintFunc) \
f(int, 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 @@ -242,8 +242,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
4 changes: 2 additions & 2 deletions test/lib-test/jdk/test/whitebox/vm_flags/SizeTTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2023, 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
Expand Down Expand Up @@ -35,7 +35,7 @@
import jdk.test.lib.Platform;

public class SizeTTest {
private static final String FLAG_NAME = "LargePageSizeInBytes";
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