Skip to content

8358748: Large page size initialization fails with assert "page_size must be a power of 2" #25994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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 @@ -127,3 +127,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 @@ -40,7 +40,8 @@
f(int, ObjectAlignmentInBytesConstraintFunc) \
f(int, ContendedPaddingWidthConstraintFunc) \
f(size_t, 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 = "NUMASpaceResizeRate";
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