8369346: Remove default value of and deprecate the MaxRAM flag

Reviewed-by: ayang, lkorinth
This commit is contained in:
Joel Sikström 2025-10-29 12:47:18 +00:00
parent 4a0200caf9
commit 6964cede02
17 changed files with 32 additions and 74 deletions

View File

@ -53,7 +53,6 @@ define_pd_global(size_t, CodeCacheExpansionSize, 32*K );
define_pd_global(size_t, CodeCacheMinBlockLength, 1);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(bool, NeverActAsServerClassMachine, true );
define_pd_global(uint64_t,MaxRAM, 1ULL*G);
define_pd_global(bool, CICompileOSR, true );
#endif // !COMPILER2
define_pd_global(bool, UseTypeProfile, false);

View File

@ -55,7 +55,6 @@ define_pd_global(size_t, InitialCodeCacheSize, 2496*K); // Integral multip
define_pd_global(size_t, CodeCacheExpansionSize, 64*K);
// Ergonomics related flags
define_pd_global(uint64_t,MaxRAM, 128ULL*G);
define_pd_global(intx, RegisterCostAreaRatio, 16000);
// Peephole and CISC spilling both break the graph, and so makes the

View File

@ -54,7 +54,6 @@ define_pd_global(size_t, CodeCacheExpansionSize, 32*K );
define_pd_global(size_t, CodeCacheMinBlockLength, 1);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(bool, NeverActAsServerClassMachine, true);
define_pd_global(uint64_t, MaxRAM, 1ULL*G);
define_pd_global(bool, CICompileOSR, true );
#endif // COMPILER2
define_pd_global(bool, UseTypeProfile, false);

View File

@ -80,9 +80,6 @@ define_pd_global(size_t, NonProfiledCodeHeapSize, 21*M);
define_pd_global(size_t, ProfiledCodeHeapSize, 22*M);
define_pd_global(size_t, NonNMethodCodeHeapSize, 5*M );
define_pd_global(size_t, CodeCacheExpansionSize, 64*K);
// Ergonomics related flags
define_pd_global(uint64_t, MaxRAM, 128ULL*G);
#else
// InitialCodeCacheSize derived from specjbb2000 run.
define_pd_global(size_t, InitialCodeCacheSize, 1536*K); // Integral multiple of CodeCacheExpansionSize
@ -91,8 +88,6 @@ define_pd_global(size_t, NonProfiledCodeHeapSize, 13*M);
define_pd_global(size_t, ProfiledCodeHeapSize, 14*M);
define_pd_global(size_t, NonNMethodCodeHeapSize, 5*M );
define_pd_global(size_t, CodeCacheExpansionSize, 32*K);
// Ergonomics related flags
define_pd_global(uint64_t, MaxRAM, 4ULL*G);
#endif
define_pd_global(size_t, CodeCacheMinBlockLength, 6);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);

View File

@ -53,7 +53,6 @@ define_pd_global(size_t, CodeCacheMinBlockLength, 1);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(bool, NeverActAsServerClassMachine, true);
define_pd_global(size_t, NewSizeThreadIncrease, 16*K);
define_pd_global(uint64_t, MaxRAM, 1ULL*G);
define_pd_global(size_t, InitialCodeCacheSize, 160*K);
#endif // !COMPILER2

View File

@ -86,7 +86,6 @@ define_pd_global(size_t, NonNMethodCodeHeapSize, 5*M );
define_pd_global(size_t, CodeCacheExpansionSize, 64*K);
// Ergonomics related flags
define_pd_global(uint64_t, MaxRAM, 128ULL*G);
define_pd_global(size_t, CodeCacheMinBlockLength, 6);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);

View File

@ -53,7 +53,6 @@ define_pd_global(size_t, CodeCacheExpansionSize, 32*K );
define_pd_global(size_t, CodeCacheMinBlockLength, 1);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(bool, NeverActAsServerClassMachine, true );
define_pd_global(uint64_t, MaxRAM, 1ULL*G);
define_pd_global(bool, CICompileOSR, true );
#endif // !COMPILER2
define_pd_global(bool, UseTypeProfile, false);

View File

@ -55,7 +55,6 @@ define_pd_global(size_t, InitialCodeCacheSize, 2496*K); // Integral multip
define_pd_global(size_t, CodeCacheExpansionSize, 64*K);
// Ergonomics related flags
define_pd_global(uint64_t,MaxRAM, 128ULL*G);
define_pd_global(intx, RegisterCostAreaRatio, 16000);
// Peephole and CISC spilling both break the graph, and so makes the

View File

@ -53,7 +53,6 @@ define_pd_global(size_t, CodeCacheMinBlockLength, 1);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(bool, NeverActAsServerClassMachine, true);
define_pd_global(size_t, NewSizeThreadIncrease, 16*K);
define_pd_global(uint64_t, MaxRAM, 1ULL*G);
define_pd_global(size_t, InitialCodeCacheSize, 160*K);
#endif // !COMPILER2

View File

@ -74,7 +74,6 @@ define_pd_global(size_t, NonNMethodCodeHeapSize, 5*M);
define_pd_global(size_t, CodeCacheExpansionSize, 64*K);
// Ergonomics related flags
define_pd_global(uint64_t, MaxRAM, 128ULL*G);
define_pd_global(size_t, CodeCacheMinBlockLength, 4);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);

View File

@ -52,7 +52,6 @@ define_pd_global(size_t, CodeCacheExpansionSize, 32*K );
define_pd_global(size_t, CodeCacheMinBlockLength, 1 );
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(bool, NeverActAsServerClassMachine, true );
define_pd_global(uint64_t, MaxRAM, 1ULL*G);
define_pd_global(bool, CICompileOSR, true );
#endif // !COMPILER2
define_pd_global(bool, UseTypeProfile, false);

View File

@ -52,9 +52,6 @@ define_pd_global(intx, LoopUnrollLimit, 60);
// InitialCodeCacheSize derived from specjbb2000 run.
define_pd_global(size_t, InitialCodeCacheSize, 2496*K); // Integral multiple of CodeCacheExpansionSize
define_pd_global(size_t, CodeCacheExpansionSize, 64*K);
// Ergonomics related flags
define_pd_global(uint64_t, MaxRAM, 128ULL*G);
#else
define_pd_global(intx, InteriorEntryAlignment, 4);
define_pd_global(size_t, NewSizeThreadIncrease, 4*K);
@ -62,9 +59,6 @@ define_pd_global(intx, LoopUnrollLimit, 50); // Design center r
// InitialCodeCacheSize derived from specjbb2000 run.
define_pd_global(size_t, InitialCodeCacheSize, 2304*K); // Integral multiple of CodeCacheExpansionSize
define_pd_global(size_t, CodeCacheExpansionSize, 32*K);
// Ergonomics related flags
define_pd_global(uint64_t, MaxRAM, 4ULL*G);
#endif // AMD64
define_pd_global(intx, RegisterCostAreaRatio, 16000);

View File

@ -4160,11 +4160,6 @@ void os::win32::initialize_system_info() {
}
_physical_memory = static_cast<physical_memory_size_type>(ms.ullTotalPhys);
if (FLAG_IS_DEFAULT(MaxRAM)) {
// Adjust MaxRAM according to the maximum virtual address space available.
FLAG_SET_DEFAULT(MaxRAM, MIN2(MaxRAM, (uint64_t) ms.ullTotalVirtual));
}
_is_windows_server = IsWindowsServer();
initialize_performance_counter();

View File

@ -72,12 +72,10 @@ define_pd_global(size_t, CodeCacheMinBlockLength, 1);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 200*K);
#ifndef ZERO
define_pd_global(bool, NeverActAsServerClassMachine, true);
define_pd_global(uint64_t,MaxRAM, 1ULL*G);
#else
// Zero runs without compilers. Do not let this code to force
// the GC mode and default heap settings.
define_pd_global(bool, NeverActAsServerClassMachine, false);
define_pd_global(uint64_t,MaxRAM, 128ULL*G);
#endif
#define CI_COMPILER_COUNT 0
#else

View File

@ -268,8 +268,9 @@
product(bool, AlwaysActAsServerClassMachine, false, \
"Always act like a server-class machine") \
\
product_pd(uint64_t, MaxRAM, \
"Real memory size (in bytes) used to set maximum heap size") \
product(uint64_t, MaxRAM, 0, \
"(Deprecated) Real memory size (in bytes) used to set maximum " \
"heap size") \
range(0, 0XFFFFFFFFFFFFFFFF) \
\
product(bool, AggressiveHeap, false, \

View File

@ -536,6 +536,7 @@ static SpecialFlag const special_jvm_flags[] = {
{ "ParallelRefProcEnabled", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
{ "ParallelRefProcBalancingEnabled", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
{ "PSChunkLargeArrays", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
{ "MaxRAM", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
// --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
{ "CreateMinidumpOnCrash", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
@ -1511,44 +1512,28 @@ static size_t clamp_by_size_t_max(uint64_t value) {
}
void Arguments::set_heap_size() {
uint64_t physical_memory;
// Check if the user has configured any limit on the amount of RAM we may use.
bool has_ram_limit = !FLAG_IS_DEFAULT(MaxRAMPercentage) ||
!FLAG_IS_DEFAULT(MinRAMPercentage) ||
!FLAG_IS_DEFAULT(InitialRAMPercentage) ||
!FLAG_IS_DEFAULT(MaxRAM);
if (CompilerConfig::should_set_client_emulation_mode_flags() &&
FLAG_IS_DEFAULT(MaxRAM)) {
// Reduce the maximum available memory if client emulation mode is enabled.
FLAG_SET_DEFAULT(MaxRAM, 1ULL*G);
}
if (has_ram_limit) {
if (!FLAG_IS_DEFAULT(MaxRAM)) {
// The user has configured MaxRAM, use that instead of physical memory
// reported by the OS.
physical_memory = MaxRAM;
if (FLAG_IS_DEFAULT(MaxRAM)) {
if (CompilerConfig::should_set_client_emulation_mode_flags()) {
// Limit the available memory if client emulation mode is enabled.
FLAG_SET_ERGO(MaxRAM, 1ULL*G);
} else {
// The user has configured a limit, make sure MaxRAM reflects the physical
// memory limit that heap sizing takes into account.
physical_memory = os::physical_memory();
FLAG_SET_ERGO(MaxRAM, physical_memory);
// Use the available physical memory on the system.
FLAG_SET_ERGO(MaxRAM, os::physical_memory());
}
} else {
// If the user did not specify any limit, choose the lowest of the available
// physical memory and MaxRAM. MaxRAM is typically set to 128GB on 64-bit
// architecture.
physical_memory = MIN2(os::physical_memory(), MaxRAM);
}
// If the maximum heap size has not been set with -Xmx, then set it as
// fraction of the size of physical memory, respecting the maximum and
// minimum sizes of the heap.
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
uint64_t min_memory = (uint64_t)(((double)physical_memory * MinRAMPercentage) / 100);
uint64_t max_memory = (uint64_t)(((double)physical_memory * MaxRAMPercentage) / 100);
uint64_t min_memory = (uint64_t)(((double)MaxRAM * MinRAMPercentage) / 100);
uint64_t max_memory = (uint64_t)(((double)MaxRAM * MaxRAMPercentage) / 100);
const size_t reasonable_min = clamp_by_size_t_max(min_memory);
size_t reasonable_max = clamp_by_size_t_max(max_memory);
@ -1635,7 +1620,7 @@ void Arguments::set_heap_size() {
reasonable_minimum = limit_heap_by_allocatable_memory(reasonable_minimum);
if (InitialHeapSize == 0) {
uint64_t initial_memory = (uint64_t)(((double)physical_memory * InitialRAMPercentage) / 100);
uint64_t initial_memory = (uint64_t)(((double)MaxRAM * InitialRAMPercentage) / 100);
size_t reasonable_initial = clamp_by_size_t_max(initial_memory);
reasonable_initial = limit_heap_by_allocatable_memory(reasonable_initial);

View File

@ -2566,25 +2566,6 @@ Java HotSpot VM.
: Sets the maximum size (in bytes) of the heap for the young generation
(nursery). The default value is set ergonomically.
`-XX:MaxRAM=`*size*
: Sets the maximum amount of memory that the JVM may use for the Java heap
before applying ergonomics heuristics. The default value is the maximum
amount of available memory to the JVM process or 128 GB, whichever is lower.
The maximum amount of available memory to the JVM process is the minimum
of the machine's physical memory and any constraints set by the environment
(e.g. container).
Specifying this option disables automatic use of compressed oops if
the combined result of this and other options influencing the maximum amount
of memory is larger than the range of memory addressable by compressed oops.
See `-XX:UseCompressedOops` for further information about compressed oops.
The following example shows how to set the maximum amount of available
memory for sizing the Java heap to 2 GB:
> `-XX:MaxRAM=2G`
`-XX:MaxRAMPercentage=`*percent*
: Sets the maximum amount of memory that the JVM may use for the Java heap
before applying ergonomics heuristics as a percentage of the maximum amount
@ -2951,6 +2932,25 @@ they're used.
(`-XX:+UseParallelGC` or `-XX:+UseG1GC`). Other collectors employing multiple
threads always perform reference processing in parallel.
`-XX:MaxRAM=`*size*
: Sets the maximum amount of memory that the JVM may use for the Java heap
before applying ergonomics heuristics. The default value is the amount of
available memory to the JVM process.
The maximum amount of available memory to the JVM process is the minimum
of the machine's physical memory and any constraints set by the environment
(e.g. container).
Specifying this option disables automatic use of compressed oops if
the combined result of this and other options influencing the maximum amount
of memory is larger than the range of memory addressable by compressed oops.
See `-XX:UseCompressedOops` for further information about compressed oops.
The following example shows how to set the maximum amount of available
memory for sizing the Java heap to 2 GB:
> `-XX:MaxRAM=2G`
## Obsolete Java Options
These `java` options are still accepted but ignored, and a warning is issued