From 3180b4ae10e538daf9b3b3da4be12d0b68858eaf Mon Sep 17 00:00:00 2001 From: sjohanss Date: Tue, 26 Nov 2019 15:23:15 +0800 Subject: [PATCH] 8156028: G1YoungGenSizer _adaptive_size not correct when setting NewSize and MaxNewSize to the same value Reviewed-by: jmasa, sangheki, drwhite, phh Contributed-by: maoliang.ml@alibaba-inc.com --- src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp | 2 +- src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index c4463f50f..b25ab59f2 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -376,7 +376,7 @@ G1YoungGenSizer::G1YoungGenSizer() : _sizer_kind(SizerDefaults), _adaptive_size( MAX2((uint) (MaxNewSize / HeapRegion::GrainBytes), 1U); _sizer_kind = SizerMaxAndNewSize; - _adaptive_size = _min_desired_young_length == _max_desired_young_length; + _adaptive_size = _min_desired_young_length != _max_desired_young_length; } else { _sizer_kind = SizerNewSizeOnly; } diff --git a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp index 96e4dc63d..d15dee26c 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @@ -133,7 +133,11 @@ private: SizerKind _sizer_kind; uint _min_desired_young_length; uint _max_desired_young_length; + + // False when using a fixed young generation size due to command-line options, + // true otherwise. bool _adaptive_size; + uint calculate_default_min_length(uint new_number_of_heap_regions); uint calculate_default_max_length(uint new_number_of_heap_regions); -- GitLab