提交 68148a0f 编写于 作者: B brutisso

8019902: G1: Use the average heap size rather than the minimum heap size to...

8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size
Reviewed-by: tonyp, tschatzl, sjohanss
上级 2a5cc4d7
...@@ -168,7 +168,15 @@ G1CollectorPolicy::G1CollectorPolicy() : ...@@ -168,7 +168,15 @@ G1CollectorPolicy::G1CollectorPolicy() :
// Set up the region size and associated fields. Given that the // Set up the region size and associated fields. Given that the
// policy is created before the heap, we have to set this up here, // policy is created before the heap, we have to set this up here,
// so it's done as soon as possible. // so it's done as soon as possible.
HeapRegion::setup_heap_region_size(Arguments::min_heap_size());
// It would have been natural to pass initial_heap_byte_size() and
// max_heap_byte_size() to setup_heap_region_size() but those have
// not been set up at this point since they should be aligned with
// the region size. So, there is a circular dependency here. We base
// the region size on the heap size, but the heap size should be
// aligned with the region size. To get around this we use the
// unaligned values for the heap.
HeapRegion::setup_heap_region_size(InitialHeapSize, MaxHeapSize);
HeapRegionRemSet::setup_remset_size(); HeapRegionRemSet::setup_remset_size();
G1ErgoVerbose::initialize(); G1ErgoVerbose::initialize();
......
...@@ -149,18 +149,11 @@ void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr, ...@@ -149,18 +149,11 @@ void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr,
// many regions in the heap (based on the min heap size). // many regions in the heap (based on the min heap size).
#define TARGET_REGION_NUMBER 2048 #define TARGET_REGION_NUMBER 2048
void HeapRegion::setup_heap_region_size(uintx min_heap_size) { void HeapRegion::setup_heap_region_size(size_t initial_heap_size, size_t max_heap_size) {
// region_size in bytes
uintx region_size = G1HeapRegionSize; uintx region_size = G1HeapRegionSize;
if (FLAG_IS_DEFAULT(G1HeapRegionSize)) { if (FLAG_IS_DEFAULT(G1HeapRegionSize)) {
// We base the automatic calculation on the min heap size. This size_t average_heap_size = (initial_heap_size + max_heap_size) / 2;
// can be problematic if the spread between min and max is quite region_size = MAX2(average_heap_size / TARGET_REGION_NUMBER,
// wide, imagine -Xms128m -Xmx32g. But, if we decided it based on
// the max size, the region size might be way too large for the
// min size. Either way, some users might have to set the region
// size manually for some -Xms / -Xmx combos.
region_size = MAX2(min_heap_size / TARGET_REGION_NUMBER,
(uintx) MIN_REGION_SIZE); (uintx) MIN_REGION_SIZE);
} }
......
...@@ -361,7 +361,7 @@ class HeapRegion: public G1OffsetTableContigSpace { ...@@ -361,7 +361,7 @@ class HeapRegion: public G1OffsetTableContigSpace {
// CardsPerRegion). All those fields are considered constant // CardsPerRegion). All those fields are considered constant
// throughout the JVM's execution, therefore they should only be set // throughout the JVM's execution, therefore they should only be set
// up once during initialization time. // up once during initialization time.
static void setup_heap_region_size(uintx min_heap_size); static void setup_heap_region_size(size_t initial_heap_size, size_t max_heap_size);
enum ClaimValues { enum ClaimValues {
InitialClaimValue = 0, InitialClaimValue = 0,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册