8222185: Shenandoah should report "committed" as capacity
authorshade
Tue, 09 Apr 2019 21:20:15 +0200
changeset 54477 511be32f3863
parent 54476 20f7bbfc61d3
child 54478 cdc54443fee5
8222185: Shenandoah should report "committed" as capacity Reviewed-by: zgu, rkennke
src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp
src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp
src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp
src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp
src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp
src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp
src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp
--- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp	Tue Apr 09 12:17:03 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp	Tue Apr 09 21:20:15 2019 +0200
@@ -72,7 +72,7 @@
   // we hit max_cset. When max_cset is hit, we terminate the cset selection. Note that in this scheme,
   // ShenandoahGarbageThreshold is the soft threshold which would be ignored until min_garbage is hit.
 
-  size_t capacity    = ShenandoahHeap::heap()->capacity();
+  size_t capacity    = ShenandoahHeap::heap()->max_capacity();
   size_t free_target = ShenandoahMinFreeThreshold * capacity / 100;
   size_t min_garbage = free_target > actual_free ? (free_target - actual_free) : 0;
   size_t max_cset    = (size_t)(1.0 * ShenandoahEvacReserve * capacity / 100 / ShenandoahEvacWaste);
@@ -123,12 +123,12 @@
 
 bool ShenandoahAdaptiveHeuristics::should_start_normal_gc() const {
   ShenandoahHeap* heap = ShenandoahHeap::heap();
-  size_t capacity = heap->capacity();
+  size_t capacity = heap->max_capacity();
   size_t available = heap->free_set()->available();
 
   // Check if we are falling below the worst limit, time to trigger the GC, regardless of
   // anything else.
-  size_t min_threshold = ShenandoahMinFreeThreshold * heap->capacity() / 100;
+  size_t min_threshold = ShenandoahMinFreeThreshold * heap->max_capacity() / 100;
   if (available < min_threshold) {
     log_info(gc)("Trigger: Free (" SIZE_FORMAT "M) is below minimum threshold (" SIZE_FORMAT "M)",
                  available / M, min_threshold / M);
@@ -138,7 +138,7 @@
   // Check if are need to learn a bit about the application
   const size_t max_learn = ShenandoahLearningSteps;
   if (_gc_times_learned < max_learn) {
-    size_t init_threshold = ShenandoahInitFreeThreshold * heap->capacity() / 100;
+    size_t init_threshold = ShenandoahInitFreeThreshold * heap->max_capacity() / 100;
     if (available < init_threshold) {
       log_info(gc)("Trigger: Learning " SIZE_FORMAT " of " SIZE_FORMAT ". Free (" SIZE_FORMAT "M) is below initial threshold (" SIZE_FORMAT "M)",
                    _gc_times_learned + 1, max_learn, available / M, init_threshold / M);
--- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp	Tue Apr 09 12:17:03 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp	Tue Apr 09 21:20:15 2019 +0200
@@ -53,8 +53,8 @@
   ShenandoahHeap* heap = ShenandoahHeap::heap();
 
   size_t available = heap->free_set()->available();
-  size_t threshold_bytes_allocated = heap->capacity() * ShenandoahAllocationThreshold / 100;
-  size_t min_threshold = ShenandoahMinFreeThreshold * heap->capacity() / 100;
+  size_t threshold_bytes_allocated = heap->max_capacity() * ShenandoahAllocationThreshold / 100;
+  size_t min_threshold = ShenandoahMinFreeThreshold * heap->max_capacity() / 100;
 
   if (available < min_threshold) {
     log_info(gc)("Trigger: Free (" SIZE_FORMAT "M) is below minimum threshold (" SIZE_FORMAT "M)",
--- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp	Tue Apr 09 12:17:03 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp	Tue Apr 09 21:20:15 2019 +0200
@@ -81,7 +81,7 @@
 
   // Do not select too large CSet that would overflow the available free space.
   // Take at least the entire evacuation reserve, and be free to overflow to free space.
-  size_t capacity  = ShenandoahHeap::heap()->capacity();
+  size_t capacity  = ShenandoahHeap::heap()->max_capacity();
   size_t available = MAX2(ShenandoahEvacReserve * capacity / 100, actual_free);
   size_t max_cset  = (size_t)(available / ShenandoahEvacWaste);
 
--- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp	Tue Apr 09 12:17:03 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp	Tue Apr 09 21:20:15 2019 +0200
@@ -52,7 +52,7 @@
 bool ShenandoahStaticHeuristics::should_start_normal_gc() const {
   ShenandoahHeap* heap = ShenandoahHeap::heap();
 
-  size_t capacity = heap->capacity();
+  size_t capacity = heap->max_capacity();
   size_t available = heap->free_set()->available();
   size_t threshold_available = (capacity * ShenandoahFreeThreshold) / 100;
 
--- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp	Tue Apr 09 12:17:03 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp	Tue Apr 09 21:20:15 2019 +0200
@@ -124,7 +124,7 @@
   // The significant complication is that liveness data was collected at the previous cycle, and only
   // for those regions that were allocated before previous cycle started.
 
-  size_t capacity    = heap->capacity();
+  size_t capacity    = heap->max_capacity();
   size_t actual_free = heap->free_set()->available();
   size_t free_target = ShenandoahMinFreeThreshold * capacity / 100;
   size_t min_garbage = free_target > actual_free ? (free_target - actual_free) : 0;
@@ -213,12 +213,12 @@
   ShenandoahHeap* heap = ShenandoahHeap::heap();
   assert(!heap->has_forwarded_objects(), "no forwarded objects here");
 
-  size_t capacity = heap->capacity();
+  size_t capacity = heap->max_capacity();
   size_t available = heap->free_set()->available();
 
   // Check if we are falling below the worst limit, time to trigger the GC, regardless of
   // anything else.
-  size_t min_threshold = ShenandoahMinFreeThreshold * heap->capacity() / 100;
+  size_t min_threshold = ShenandoahMinFreeThreshold * heap->max_capacity() / 100;
   if (available < min_threshold) {
     log_info(gc)("Trigger: Free (" SIZE_FORMAT "M) is below minimum threshold (" SIZE_FORMAT "M)",
                  available / M, min_threshold / M);
@@ -228,7 +228,7 @@
   // Check if are need to learn a bit about the application
   const size_t max_learn = ShenandoahLearningSteps;
   if (_gc_times_learned < max_learn) {
-    size_t init_threshold = ShenandoahInitFreeThreshold * heap->capacity() / 100;
+    size_t init_threshold = ShenandoahInitFreeThreshold * heap->max_capacity() / 100;
     if (available < init_threshold) {
       log_info(gc)("Trigger: Learning " SIZE_FORMAT " of " SIZE_FORMAT ". Free (" SIZE_FORMAT "M) is below initial threshold (" SIZE_FORMAT "M)",
                    _gc_times_learned + 1, max_learn, available / M, init_threshold / M);
--- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp	Tue Apr 09 12:17:03 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp	Tue Apr 09 21:20:15 2019 +0200
@@ -430,7 +430,7 @@
   }
 
   // Evac reserve: reserve trailing space for evacuations
-  size_t to_reserve = ShenandoahEvacReserve * _heap->capacity() / 100;
+  size_t to_reserve = ShenandoahEvacReserve * _heap->max_capacity() / 100;
   size_t reserved = 0;
 
   for (size_t idx = _heap->num_regions() - 1; idx > 0; idx--) {
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Tue Apr 09 12:17:03 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Tue Apr 09 21:20:15 2019 +0200
@@ -502,7 +502,7 @@
 void ShenandoahHeap::print_on(outputStream* st) const {
   st->print_cr("Shenandoah Heap");
   st->print_cr(" " SIZE_FORMAT "K total, " SIZE_FORMAT "K committed, " SIZE_FORMAT "K used",
-               capacity() / K, committed() / K, used() / K);
+               max_capacity() / K, committed() / K, used() / K);
   st->print_cr(" " SIZE_FORMAT " x " SIZE_FORMAT"K regions",
                num_regions(), ShenandoahHeapRegion::region_size_bytes() / K);
 
@@ -615,7 +615,7 @@
 }
 
 size_t ShenandoahHeap::capacity() const {
-  return num_regions() * ShenandoahHeapRegion::region_size_bytes();
+  return committed();
 }
 
 size_t ShenandoahHeap::max_capacity() const {
@@ -649,8 +649,6 @@
   }
 
   if (count > 0) {
-    log_info(gc)("Uncommitted " SIZE_FORMAT "M. Heap: " SIZE_FORMAT "M reserved, " SIZE_FORMAT "M committed, " SIZE_FORMAT "M used",
-                 count * ShenandoahHeapRegion::region_size_bytes() / M, capacity() / M, committed() / M, used() / M);
     control_thread()->notify_heap_changed();
   }
 }
--- a/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp	Tue Apr 09 12:17:03 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp	Tue Apr 09 21:20:15 2019 +0200
@@ -46,12 +46,12 @@
   ShenandoahHeap* _heap;
 public:
   ShenandoahGenerationCounters(ShenandoahHeap* heap) :
-          GenerationCounters("Heap", 1, 1, heap->initial_capacity(), heap->max_capacity(), heap->committed()),
+          GenerationCounters("Heap", 1, 1, heap->initial_capacity(), heap->max_capacity(), heap->capacity()),
           _heap(heap)
   {};
 
   virtual void update_all() {
-    _current_size->set_value(_heap->committed());
+    _current_size->set_value(_heap->capacity());
   }
 };
 
@@ -94,7 +94,7 @@
   if (UsePerfData) {
     ShenandoahHeap* heap = ShenandoahHeap::heap();
     size_t used = heap->used();
-    size_t capacity = heap->capacity();
+    size_t capacity = heap->max_capacity();
     _heap_counters->update_all();
     _space_counters->update_all(capacity, used);
     _heap_region_counters->update();
--- a/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp	Tue Apr 09 12:17:03 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp	Tue Apr 09 21:20:15 2019 +0200
@@ -153,7 +153,7 @@
 void ShenandoahPacer::setup_for_idle() {
   assert(ShenandoahPacing, "Only be here when pacing is enabled");
 
-  size_t initial = _heap->capacity() * ShenandoahPacingIdleSlack / 100;
+  size_t initial = _heap->max_capacity() * ShenandoahPacingIdleSlack / 100;
   double tax = 1;
 
   restart_with(initial, tax);
@@ -166,7 +166,7 @@
   if (_progress == -1) {
     // First initialization, report some prior
     Atomic::store((intptr_t)PACING_PROGRESS_ZERO, &_progress);
-    return (size_t) (_heap->capacity() * 0.1);
+    return (size_t) (_heap->max_capacity() * 0.1);
   } else {
     // Record history, and reply historical data
     _progress_history->add(_progress);