8316319: Generational ZGC: The SoftMaxHeapSize might be wrong when CDS decreases the MaxHeapSize
Reviewed-by: aboldtch, serb
This commit is contained in:
parent
775e22a8a6
commit
fe862639e7
src/hotspot/share/gc
@ -37,6 +37,10 @@ void XArguments::initialize_alignments() {
|
||||
HeapAlignment = SpaceAlignment;
|
||||
}
|
||||
|
||||
void XArguments::initialize_heap_flags_and_sizes() {
|
||||
// Nothing extra to do
|
||||
}
|
||||
|
||||
void XArguments::initialize() {
|
||||
// Check mark stack size
|
||||
const size_t mark_stack_space_limit = XAddressSpaceLimit::mark_stack();
|
||||
|
@ -31,6 +31,7 @@ class CollectedHeap;
|
||||
class XArguments : AllStatic {
|
||||
public:
|
||||
static void initialize_alignments();
|
||||
static void initialize_heap_flags_and_sizes();
|
||||
static void initialize();
|
||||
static size_t heap_virtual_to_physical_ratio();
|
||||
static CollectedHeap* create_heap();
|
||||
|
@ -38,6 +38,16 @@ void ZSharedArguments::initialize_alignments() {
|
||||
}
|
||||
}
|
||||
|
||||
void ZSharedArguments::initialize_heap_flags_and_sizes() {
|
||||
GCArguments::initialize_heap_flags_and_sizes();
|
||||
|
||||
if (ZGenerational) {
|
||||
ZArguments::initialize_heap_flags_and_sizes();
|
||||
} else {
|
||||
XArguments::initialize_heap_flags_and_sizes();
|
||||
}
|
||||
}
|
||||
|
||||
void ZSharedArguments::initialize() {
|
||||
GCArguments::initialize();
|
||||
|
||||
|
@ -31,6 +31,7 @@ class CollectedHeap;
|
||||
class ZSharedArguments : public GCArguments {
|
||||
private:
|
||||
virtual void initialize_alignments();
|
||||
virtual void initialize_heap_flags_and_sizes();
|
||||
|
||||
virtual void initialize();
|
||||
virtual size_t conservative_max_heap_alignment();
|
||||
|
@ -37,6 +37,19 @@ void ZArguments::initialize_alignments() {
|
||||
HeapAlignment = SpaceAlignment;
|
||||
}
|
||||
|
||||
void ZArguments::initialize_heap_flags_and_sizes() {
|
||||
if (!FLAG_IS_CMDLINE(MaxHeapSize) &&
|
||||
!FLAG_IS_CMDLINE(MaxRAMFraction) &&
|
||||
!FLAG_IS_CMDLINE(MaxRAMPercentage) &&
|
||||
!FLAG_IS_CMDLINE(SoftMaxHeapSize)) {
|
||||
// We are really just guessing how much memory the program needs.
|
||||
// When that is the case, we don't want the soft and hard limits to be the same
|
||||
// as it can cause flakyness in the number of GC threads used, in order to keep
|
||||
// to a random number we just pulled out of thin air.
|
||||
FLAG_SET_ERGO(SoftMaxHeapSize, MaxHeapSize * 90 / 100);
|
||||
}
|
||||
}
|
||||
|
||||
void ZArguments::select_max_gc_threads() {
|
||||
// Select number of parallel threads
|
||||
if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
|
||||
@ -126,16 +139,6 @@ void ZArguments::initialize() {
|
||||
FLAG_SET_ERGO_IF_DEFAULT(ZCollectionIntervalMajor, ZCollectionInterval);
|
||||
}
|
||||
|
||||
if (!FLAG_IS_CMDLINE(MaxHeapSize) &&
|
||||
!FLAG_IS_CMDLINE(MaxRAMFraction) &&
|
||||
!FLAG_IS_CMDLINE(MaxRAMPercentage)) {
|
||||
// We are really just guessing how much memory the program needs.
|
||||
// When that is the case, we don't want the soft and hard limits to be the same
|
||||
// as it can cause flakyness in the number of GC threads used, in order to keep
|
||||
// to a random number we just pulled out of thin air.
|
||||
FLAG_SET_ERGO_IF_DEFAULT(SoftMaxHeapSize, MaxHeapSize * 90 / 100);
|
||||
}
|
||||
|
||||
if (FLAG_IS_DEFAULT(ZFragmentationLimit)) {
|
||||
FLAG_SET_DEFAULT(ZFragmentationLimit, 5.0);
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ private:
|
||||
|
||||
public:
|
||||
static void initialize_alignments();
|
||||
static void initialize_heap_flags_and_sizes();
|
||||
static void initialize();
|
||||
static size_t heap_virtual_to_physical_ratio();
|
||||
static CollectedHeap* create_heap();
|
||||
|
Loading…
x
Reference in New Issue
Block a user