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
4 changes: 0 additions & 4 deletions src/hotspot/share/gc/shared/gc_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,6 @@
"and ObjArrayMarkingStride.") \
constraint(ArrayMarkingMinStrideConstraintFunc,AfterErgo) \
\
product(bool, AggressiveHeap, false, \
"(Deprecated) Optimize heap options for long-running memory " \
"intensive apps") \
\
product(size_t, ErgoHeapSizeLimit, 0, \
"Maximum ergonomically set heap size (in bytes); zero means use " \
"(System RAM) * MaxRAMPercentage / 100") \
Expand Down
121 changes: 2 additions & 119 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,6 @@ static SpecialFlag const special_jvm_flags[] = {
{ "DynamicDumpSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
{ "RequireSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
{ "UseSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
{ "AggressiveHeap", 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() },

Expand All @@ -556,6 +555,7 @@ static SpecialFlag const special_jvm_flags[] = {
{ "AlwaysActAsServerClassMachine", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
{ "UseXMMForArrayCopy", JDK_Version::undefined(), JDK_Version::jdk(27), JDK_Version::jdk(28) },
{ "UseNewLongLShift", JDK_Version::undefined(), JDK_Version::jdk(27), JDK_Version::jdk(28) },
{ "AggressiveHeap", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },

#ifdef ASSERT
{ "DummyObsoleteTestFlag", JDK_Version::undefined(), JDK_Version::jdk(18), JDK_Version::undefined() },
Expand Down Expand Up @@ -1490,13 +1490,7 @@ jint Arguments::set_ergonomics_flags() {
}

size_t Arguments::limit_heap_by_allocatable_memory(size_t limit) {
// The AggressiveHeap check is a temporary workaround to avoid calling
// GCarguments::heap_virtual_to_physical_ratio() before a GC has been
// selected. This works because AggressiveHeap implies UseParallelGC
// where we know the ratio will be 1. Once the AggressiveHeap option is
// removed, this can be cleaned up.
size_t heap_virtual_to_physical_ratio = (AggressiveHeap ? 1 : GCConfig::arguments()->heap_virtual_to_physical_ratio());
size_t fraction = MaxVirtMemFraction * heap_virtual_to_physical_ratio;
size_t fraction = MaxVirtMemFraction * GCConfig::arguments()->heap_virtual_to_physical_ratio();
size_t max_allocatable = os::commit_memory_limit();

return MIN2(limit, max_allocatable / fraction);
Expand Down Expand Up @@ -1627,107 +1621,6 @@ void Arguments::set_heap_size() {
}
}

// This option inspects the machine and attempts to set various
// parameters to be optimal for long-running, memory allocation
// intensive jobs. It is intended for machines with large
// amounts of cpu and memory.
jint Arguments::set_aggressive_heap_flags() {
// initHeapSize is needed since _initial_heap_size is 4 bytes on a 32 bit
// VM, but we may not be able to represent the total physical memory
// available (like having 8gb of memory on a box but using a 32bit VM).
// Thus, we need to make sure we're using a julong for intermediate
// calculations.
julong initHeapSize;
physical_memory_size_type phys_mem = os::physical_memory();
julong total_memory = static_cast<julong>(phys_mem);

if (total_memory < (julong) 256 * M) {
jio_fprintf(defaultStream::error_stream(),
"You need at least 256mb of memory to use -XX:+AggressiveHeap\n");
vm_exit(1);
}

// The heap size is half of available memory, or (at most)
// all of possible memory less 160mb (leaving room for the OS
// when using ISM). This is the maximum; because adaptive sizing
// is turned on below, the actual space used may be smaller.

initHeapSize = MIN2(total_memory / (julong) 2,
total_memory - (julong) 160 * M);

initHeapSize = limit_heap_by_allocatable_memory(initHeapSize);

if (FLAG_IS_DEFAULT(MaxHeapSize)) {
if (FLAG_SET_CMDLINE(MaxHeapSize, initHeapSize) != JVMFlag::SUCCESS) {
return JNI_EINVAL;
}
if (FLAG_SET_CMDLINE(InitialHeapSize, initHeapSize) != JVMFlag::SUCCESS) {
return JNI_EINVAL;
}
if (FLAG_SET_CMDLINE(MinHeapSize, initHeapSize) != JVMFlag::SUCCESS) {
return JNI_EINVAL;
}
}
if (FLAG_IS_DEFAULT(NewSize)) {
// Make the young generation 3/8ths of the total heap.
if (FLAG_SET_CMDLINE(NewSize,
((julong) MaxHeapSize / (julong) 8) * (julong) 3) != JVMFlag::SUCCESS) {
return JNI_EINVAL;
}
if (FLAG_SET_CMDLINE(MaxNewSize, NewSize) != JVMFlag::SUCCESS) {
return JNI_EINVAL;
}
}

#if !defined(_ALLBSD_SOURCE) && !defined(AIX) // UseLargePages is not yet supported on BSD and AIX.
FLAG_SET_DEFAULT(UseLargePages, true);
#endif

// Increase some data structure sizes for efficiency
if (FLAG_SET_CMDLINE(ResizeTLAB, false) != JVMFlag::SUCCESS) {
return JNI_EINVAL;
}
if (FLAG_SET_CMDLINE(TLABSize, 256 * K) != JVMFlag::SUCCESS) {
return JNI_EINVAL;
}

// See the OldPLABSize comment below, but replace 'after promotion'
// with 'after copying'. YoungPLABSize is the size of the survivor
// space per-gc-thread buffers. The default is 4kw.
if (FLAG_SET_CMDLINE(YoungPLABSize, 256 * K) != JVMFlag::SUCCESS) { // Note: this is in words
return JNI_EINVAL;
}

// OldPLABSize is the size of the buffers in the old gen that
// UseParallelGC uses to promote live data that doesn't fit in the
// survivor spaces. At any given time, there's one for each gc thread.
// The default size is 1kw. These buffers are rarely used, since the
// survivor spaces are usually big enough. For specjbb, however, there
// are occasions when there's lots of live data in the young gen
// and we end up promoting some of it. We don't have a definite
// explanation for why bumping OldPLABSize helps, but the theory
// is that a bigger PLAB results in retaining something like the
// original allocation order after promotion, which improves mutator
// locality. A minor effect may be that larger PLABs reduce the
// number of PLAB allocation events during gc. The value of 8kw
// was arrived at by experimenting with specjbb.
if (FLAG_SET_CMDLINE(OldPLABSize, 8 * K) != JVMFlag::SUCCESS) { // Note: this is in words
return JNI_EINVAL;
}

// Enable parallel GC and adaptive generation sizing
if (FLAG_SET_CMDLINE(UseParallelGC, true) != JVMFlag::SUCCESS) {
return JNI_EINVAL;
}

// Encourage steady state memory management
if (FLAG_SET_CMDLINE(ThresholdTolerance, 100) != JVMFlag::SUCCESS) {
return JNI_EINVAL;
}

return JNI_OK;
}

// This must be called after ergonomics.
void Arguments::set_bytecode_flags() {
if (!RewriteBytecodes) {
Expand Down Expand Up @@ -2938,16 +2831,6 @@ jint Arguments::finalize_vm_init_args() {
return JNI_ERR;
}

// This must be done after all arguments have been processed
// and the container support has been initialized since AggressiveHeap
// relies on the amount of total memory available.
if (AggressiveHeap) {
jint result = set_aggressive_heap_flags();
if (result != JNI_OK) {
return result;
}
}

// CompileThresholdScaling == 0.0 is same as -Xint: Disable compilation (enable interpreter-only mode),
// but like -Xint, leave compilation thresholds unaffected.
// With tiered compilation disabled, setting CompileThreshold to 0 disables compilation as well.
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/runtime/arguments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ class Arguments : AllStatic {
// Aggressive optimization flags.
static jint set_aggressive_opts_flags();

static jint set_aggressive_heap_flags();

// Argument parsing
static bool parse_argument(const char* arg, JVMFlagOrigin origin);
static bool process_argument(const char* arg, jboolean ignore_unrecognized, JVMFlagOrigin origin);
Expand Down
12 changes: 6 additions & 6 deletions src/java.base/share/man/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -2938,12 +2938,6 @@ they're used.
(`-XX:+UseParallelGC` or `-XX:+UseG1GC`). Other collectors employing multiple
threads always perform reference processing in parallel.

[`-XX:+AggressiveHeap`]{#-XX__AggressiveHeap}
: Enables Java heap optimization. This sets various parameters to be
optimal for long-running jobs with intensive memory allocation, based on
the configuration of the computer (RAM and CPU). By default, the option
is disabled and the heap sizes are configured less aggressively.

## Obsolete Java Options

These `java` options are still accepted but ignored, and a warning is issued
Expand Down Expand Up @@ -2976,6 +2970,12 @@ when they're used.
-XX:{+|-}UseJVMCICompiler
```

[`-XX:+AggressiveHeap`]{#-XX__AggressiveHeap}
: Enabled Java heap optimization. This set various parameters to be
optimal for long-running jobs with intensive memory allocation, based on
the configuration of the computer (RAM and CPU). By default, the option
was disabled and the heap sizes configured less aggressively.

## Removed Java Options

No documented java options have been removed in JDK @@VERSION_SPECIFICATION@@.
Expand Down
95 changes: 0 additions & 95 deletions test/hotspot/jtreg/gc/arguments/TestAggressiveHeap.java

This file was deleted.