changeset 60223:525cbaab106d

8240076: Shenandoah: pacer should cover reset and preclean phases Reviewed-by: zgu
author shade
date Wed, 26 Feb 2020 19:36:56 +0100
parents a1be565c0afe
children 2ec0ff304263
files src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp src/hotspot/share/gc/shenandoah/shenandoahPacer.hpp
diffstat 3 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Wed Feb 26 19:36:50 2020 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Wed Feb 26 19:36:56 2020 +0100
@@ -1814,10 +1814,16 @@
 }
 
 void ShenandoahHeap::op_reset() {
+  if (ShenandoahPacing) {
+    pacer()->setup_for_reset();
+  }
   reset_mark_bitmap();
 }
 
 void ShenandoahHeap::op_preclean() {
+  if (ShenandoahPacing) {
+    pacer()->setup_for_preclean();
+  }
   concurrent_mark()->preclean_weak_refs();
 }
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp	Wed Feb 26 19:36:50 2020 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp	Wed Feb 26 19:36:56 2020 +0100
@@ -177,6 +177,31 @@
                      tax);
 }
 
+/*
+ * There is no useful notion of progress for these operations. To avoid stalling
+ * the allocators unnecessarily, allow them to run unimpeded.
+ */
+
+void ShenandoahPacer::setup_for_preclean() {
+  assert(ShenandoahPacing, "Only be here when pacing is enabled");
+
+  size_t initial = _heap->max_capacity();
+  restart_with(initial, 1.0);
+
+  log_info(gc, ergo)("Pacer for Precleaning. Non-Taxable: " SIZE_FORMAT "%s",
+                     byte_size_in_proper_unit(initial), proper_unit_for_byte_size(initial));
+}
+
+void ShenandoahPacer::setup_for_reset() {
+  assert(ShenandoahPacing, "Only be here when pacing is enabled");
+
+  size_t initial = _heap->max_capacity();
+  restart_with(initial, 1.0);
+
+  log_info(gc, ergo)("Pacer for Reset. Non-Taxable: " SIZE_FORMAT "%s",
+                     byte_size_in_proper_unit(initial), proper_unit_for_byte_size(initial));
+}
+
 size_t ShenandoahPacer::update_and_get_progress_history() {
   if (_progress == -1) {
     // First initialization, report some prior
--- a/src/hotspot/share/gc/shenandoah/shenandoahPacer.hpp	Wed Feb 26 19:36:50 2020 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahPacer.hpp	Wed Feb 26 19:36:56 2020 +0100
@@ -74,6 +74,9 @@
   void setup_for_updaterefs();
   void setup_for_traversal();
 
+  void setup_for_reset();
+  void setup_for_preclean();
+
   inline void report_mark(size_t words);
   inline void report_evac(size_t words);
   inline void report_updaterefs(size_t words);