changeset 60756:88c5b65ff982

8252141: Rename G1YoungRemSetSamplingThread to better reflect its purpose Reviewed-by: kbarrett, tschatzl
author sjohanss
date Tue, 01 Sep 2020 15:55:56 +0200
parents ea28988e886b
children a18124b4f041
files src/hotspot/share/gc/g1/g1CollectedHeap.cpp src/hotspot/share/gc/g1/g1CollectedHeap.hpp src/hotspot/share/gc/g1/g1RemSetSummary.cpp src/hotspot/share/gc/g1/g1RemSetSummary.hpp src/hotspot/share/gc/g1/g1ServiceThread.cpp src/hotspot/share/gc/g1/g1ServiceThread.hpp src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.cpp src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.hpp src/hotspot/share/gc/g1/g1_globals.hpp
diffstat 9 files changed, 270 insertions(+), 265 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Tue Sep 01 13:35:47 2020 +0000
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Tue Sep 01 15:55:56 2020 +0200
@@ -63,7 +63,7 @@
 #include "gc/g1/g1ThreadLocalData.hpp"
 #include "gc/g1/g1Trace.hpp"
 #include "gc/g1/g1YCTypes.hpp"
-#include "gc/g1/g1YoungRemSetSamplingThread.hpp"
+#include "gc/g1/g1ServiceThread.hpp"
 #include "gc/g1/g1VMOperations.hpp"
 #include "gc/g1/heapRegion.inline.hpp"
 #include "gc/g1/heapRegionRemSet.hpp"
@@ -1419,7 +1419,7 @@
 
 G1CollectedHeap::G1CollectedHeap() :
   CollectedHeap(),
-  _young_gen_sampling_thread(NULL),
+  _service_thread(NULL),
   _workers(NULL),
   _card_table(NULL),
   _collection_pause_end(Ticks::now()),
@@ -1556,10 +1556,10 @@
   return ecode;
 }
 
-jint G1CollectedHeap::initialize_young_gen_sampling_thread() {
-  _young_gen_sampling_thread = new G1YoungRemSetSamplingThread();
-  if (_young_gen_sampling_thread->osthread() == NULL) {
-    vm_shutdown_during_initialization("Could not create G1YoungRemSetSamplingThread");
+jint G1CollectedHeap::initialize_service_thread() {
+  _service_thread = new G1ServiceThread();
+  if (_service_thread->osthread() == NULL) {
+    vm_shutdown_during_initialization("Could not create G1ServiceThread");
     return JNI_ENOMEM;
   }
   return JNI_OK;
@@ -1733,7 +1733,7 @@
     return ecode;
   }
 
-  ecode = initialize_young_gen_sampling_thread();
+  ecode = initialize_service_thread();
   if (ecode != JNI_OK) {
     return ecode;
   }
@@ -1779,7 +1779,7 @@
   // do not continue to execute and access resources (e.g. logging)
   // that are destroyed during shutdown.
   _cr->stop();
-  _young_gen_sampling_thread->stop();
+  _service_thread->stop();
   _cm_thread->stop();
   if (G1StringDedup::is_enabled()) {
     G1StringDedup::stop();
@@ -2534,7 +2534,7 @@
   tc->do_thread(_cm_thread);
   _cm->threads_do(tc);
   _cr->threads_do(tc);
-  tc->do_thread(_young_gen_sampling_thread);
+  tc->do_thread(_service_thread);
   if (G1StringDedup::is_enabled()) {
     G1StringDedup::threads_do(tc);
   }
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Tue Sep 01 13:35:47 2020 +0000
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Tue Sep 01 15:55:56 2020 +0200
@@ -80,7 +80,7 @@
 class G1Policy;
 class G1HotCardCache;
 class G1RemSet;
-class G1YoungRemSetSamplingThread;
+class G1ServiceThread;
 class G1ConcurrentMark;
 class G1ConcurrentMarkThread;
 class G1ConcurrentRefine;
@@ -154,7 +154,7 @@
   friend class G1CheckRegionAttrTableClosure;
 
 private:
-  G1YoungRemSetSamplingThread* _young_gen_sampling_thread;
+  G1ServiceThread* _service_thread;
 
   WorkGang* _workers;
   G1CardTable* _card_table;
@@ -547,7 +547,7 @@
   void verify_numa_regions(const char* desc);
 
 public:
-  G1YoungRemSetSamplingThread* sampling_thread() const { return _young_gen_sampling_thread; }
+  G1ServiceThread* service_thread() const { return _service_thread; }
 
   WorkGang* workers() const { return _workers; }
 
@@ -968,7 +968,7 @@
 
 private:
   jint initialize_concurrent_refinement();
-  jint initialize_young_gen_sampling_thread();
+  jint initialize_service_thread();
 public:
   // Initialize the G1CollectedHeap to have the initial and
   // maximum sizes and remembered and barrier sets
--- a/src/hotspot/share/gc/g1/g1RemSetSummary.cpp	Tue Sep 01 13:35:47 2020 +0000
+++ b/src/hotspot/share/gc/g1/g1RemSetSummary.cpp	Tue Sep 01 15:55:56 2020 +0200
@@ -30,7 +30,7 @@
 #include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/g1/g1RemSet.hpp"
 #include "gc/g1/g1RemSetSummary.hpp"
-#include "gc/g1/g1YoungRemSetSamplingThread.hpp"
+#include "gc/g1/g1ServiceThread.hpp"
 #include "gc/g1/heapRegion.hpp"
 #include "gc/g1/heapRegionRemSet.hpp"
 #include "memory/allocation.inline.hpp"
@@ -53,7 +53,7 @@
   g1h->concurrent_refine()->threads_do(&collector);
   _num_coarsenings = HeapRegionRemSet::n_coarsenings();
 
-  set_sampling_thread_vtime(g1h->sampling_thread()->vtime_accum());
+  set_service_thread_vtime(g1h->service_thread()->vtime_accum());
 }
 
 void G1RemSetSummary::set_rs_thread_vtime(uint thread, double value) {
@@ -72,7 +72,7 @@
   _num_coarsenings(0),
   _num_vtimes(G1ConcurrentRefine::max_num_threads()),
   _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)),
-  _sampling_thread_vtime(0.0f) {
+  _service_thread_vtime(0.0f) {
 
   memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes);
 
@@ -93,7 +93,7 @@
 
   memcpy(_rs_threads_vtimes, other->_rs_threads_vtimes, sizeof(double) * _num_vtimes);
 
-  set_sampling_thread_vtime(other->sampling_thread_vtime());
+  set_service_thread_vtime(other->service_thread_vtime());
 }
 
 void G1RemSetSummary::subtract_from(G1RemSetSummary* other) {
@@ -106,7 +106,7 @@
     set_rs_thread_vtime(i, other->rs_thread_vtime(i) - rs_thread_vtime(i));
   }
 
-  _sampling_thread_vtime = other->sampling_thread_vtime() - _sampling_thread_vtime;
+  _service_thread_vtime = other->service_thread_vtime() - _service_thread_vtime;
 }
 
 class RegionTypeCounter {
@@ -327,8 +327,8 @@
     out->print("    %5.2f", rs_thread_vtime(i));
   }
   out->cr();
-  out->print_cr("  Concurrent sampling threads times (s)");
-  out->print_cr("         %5.2f", sampling_thread_vtime());
+  out->print_cr("  Service thread time (s)");
+  out->print_cr("         %5.2f", service_thread_vtime());
 
   HRRSStatsIter blk;
   G1CollectedHeap::heap()->heap_region_iterate(&blk);
--- a/src/hotspot/share/gc/g1/g1RemSetSummary.hpp	Tue Sep 01 13:35:47 2020 +0000
+++ b/src/hotspot/share/gc/g1/g1RemSetSummary.hpp	Tue Sep 01 15:55:56 2020 +0200
@@ -38,11 +38,11 @@
   size_t _num_vtimes;
   double* _rs_threads_vtimes;
 
-  double _sampling_thread_vtime;
+  double _service_thread_vtime;
 
   void set_rs_thread_vtime(uint thread, double value);
-  void set_sampling_thread_vtime(double value) {
-    _sampling_thread_vtime = value;
+  void set_service_thread_vtime(double value) {
+    _service_thread_vtime = value;
   }
 
   // update this summary with current data from various places
@@ -62,8 +62,8 @@
 
   double rs_thread_vtime(uint thread) const;
 
-  double sampling_thread_vtime() const {
-    return _sampling_thread_vtime;
+  double service_thread_vtime() const {
+    return _service_thread_vtime;
   }
 
   size_t num_coarsenings() const {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1ServiceThread.cpp	Tue Sep 01 15:55:56 2020 +0200
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1CollectedHeap.inline.hpp"
+#include "gc/g1/g1CollectionSet.hpp"
+#include "gc/g1/g1ConcurrentMark.inline.hpp"
+#include "gc/g1/g1ConcurrentMarkThread.inline.hpp"
+#include "gc/g1/g1Policy.hpp"
+#include "gc/g1/g1ServiceThread.hpp"
+#include "gc/g1/heapRegion.inline.hpp"
+#include "gc/g1/heapRegionRemSet.hpp"
+#include "gc/shared/suspendibleThreadSet.hpp"
+#include "memory/universe.hpp"
+#include "runtime/mutexLocker.hpp"
+#include "runtime/os.hpp"
+
+G1ServiceThread::G1ServiceThread() :
+    ConcurrentGCThread(),
+    _monitor(Mutex::nonleaf,
+             "G1ServiceThread monitor",
+             true,
+             Monitor::_safepoint_check_never),
+    _last_periodic_gc_attempt_s(os::elapsedTime()),
+    _vtime_accum(0) {
+  set_name("G1 Service");
+  create_and_start();
+}
+
+void G1ServiceThread::sleep_before_next_cycle() {
+  MonitorLocker ml(&_monitor, Mutex::_no_safepoint_check_flag);
+  if (!should_terminate()) {
+    uintx waitms = G1ConcRefinementServiceIntervalMillis;
+    ml.wait(waitms);
+  }
+}
+
+bool G1ServiceThread::should_start_periodic_gc() {
+  G1CollectedHeap* g1h = G1CollectedHeap::heap();
+  // If we are currently in a concurrent mark we are going to uncommit memory soon.
+  if (g1h->concurrent_mark()->cm_thread()->during_cycle()) {
+    log_debug(gc, periodic)("Concurrent cycle in progress. Skipping.");
+    return false;
+  }
+
+  // Check if enough time has passed since the last GC.
+  uintx time_since_last_gc = (uintx)g1h->time_since_last_collection().milliseconds();
+  if ((time_since_last_gc < G1PeriodicGCInterval)) {
+    log_debug(gc, periodic)("Last GC occurred " UINTX_FORMAT "ms before which is below threshold " UINTX_FORMAT "ms. Skipping.",
+                            time_since_last_gc, G1PeriodicGCInterval);
+    return false;
+  }
+
+  // Check if load is lower than max.
+  double recent_load;
+  if ((G1PeriodicGCSystemLoadThreshold > 0.0f) &&
+      (os::loadavg(&recent_load, 1) == -1 || recent_load > G1PeriodicGCSystemLoadThreshold)) {
+    log_debug(gc, periodic)("Load %1.2f is higher than threshold %1.2f. Skipping.",
+                            recent_load, G1PeriodicGCSystemLoadThreshold);
+    return false;
+  }
+
+  return true;
+}
+
+void G1ServiceThread::check_for_periodic_gc(){
+  // If disabled, just return.
+  if (G1PeriodicGCInterval == 0) {
+    return;
+  }
+  if ((os::elapsedTime() - _last_periodic_gc_attempt_s) > (G1PeriodicGCInterval / 1000.0)) {
+    log_debug(gc, periodic)("Checking for periodic GC.");
+    if (should_start_periodic_gc()) {
+      if (!G1CollectedHeap::heap()->try_collect(GCCause::_g1_periodic_collection)) {
+        log_debug(gc, periodic)("GC request denied. Skipping.");
+      }
+    }
+    _last_periodic_gc_attempt_s = os::elapsedTime();
+  }
+}
+
+void G1ServiceThread::run_service() {
+  double vtime_start = os::elapsedVTime();
+
+  while (!should_terminate()) {
+    sample_young_list_rs_length();
+
+    if (os::supports_vtime()) {
+      _vtime_accum = (os::elapsedVTime() - vtime_start);
+    } else {
+      _vtime_accum = 0.0;
+    }
+
+    check_for_periodic_gc();
+
+    sleep_before_next_cycle();
+  }
+}
+
+void G1ServiceThread::stop_service() {
+  MutexLocker x(&_monitor, Mutex::_no_safepoint_check_flag);
+  _monitor.notify();
+}
+
+class G1YoungRemSetSamplingClosure : public HeapRegionClosure {
+  SuspendibleThreadSetJoiner* _sts;
+  size_t _regions_visited;
+  size_t _sampled_rs_length;
+public:
+  G1YoungRemSetSamplingClosure(SuspendibleThreadSetJoiner* sts) :
+    HeapRegionClosure(), _sts(sts), _regions_visited(0), _sampled_rs_length(0) { }
+
+  virtual bool do_heap_region(HeapRegion* r) {
+    size_t rs_length = r->rem_set()->occupied();
+    _sampled_rs_length += rs_length;
+
+    // Update the collection set policy information for this region
+    G1CollectedHeap::heap()->collection_set()->update_young_region_prediction(r, rs_length);
+
+    _regions_visited++;
+
+    if (_regions_visited == 10) {
+      if (_sts->should_yield()) {
+        _sts->yield();
+        // A gc may have occurred and our sampling data is stale and further
+        // traversal of the collection set is unsafe
+        return true;
+      }
+      _regions_visited = 0;
+    }
+    return false;
+  }
+
+  size_t sampled_rs_length() const { return _sampled_rs_length; }
+};
+
+void G1ServiceThread::sample_young_list_rs_length() {
+  SuspendibleThreadSetJoiner sts;
+  G1CollectedHeap* g1h = G1CollectedHeap::heap();
+  G1Policy* policy = g1h->policy();
+
+  if (policy->use_adaptive_young_list_length()) {
+    G1YoungRemSetSamplingClosure cl(&sts);
+
+    G1CollectionSet* g1cs = g1h->collection_set();
+    g1cs->iterate(&cl);
+
+    if (cl.is_complete()) {
+      policy->revise_young_list_target_length_if_necessary(cl.sampled_rs_length());
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1ServiceThread.hpp	Tue Sep 01 15:55:56 2020 +0200
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_GC_G1_G1SERVICETHREAD_HPP
+#define SHARE_GC_G1_G1SERVICETHREAD_HPP
+
+#include "gc/shared/concurrentGCThread.hpp"
+#include "runtime/mutex.hpp"
+
+// The G1ServiceThread is used to periodically do a number of different tasks:
+//   - re-assess the validity of the prediction for the
+//     remembered set lengths of the young generation.
+//   - check if a periodic GC should be scheduled.
+class G1ServiceThread: public ConcurrentGCThread {
+private:
+  Monitor _monitor;
+
+  double _last_periodic_gc_attempt_s;
+
+  double _vtime_accum;  // Accumulated virtual time.
+
+  // Sample the current length of remembered sets for young.
+  //
+  // At the end of the GC G1 determines the length of the young gen based on
+  // how much time the next GC can take, and when the next GC may occur
+  // according to the MMU.
+  //
+  // The assumption is that a significant part of the GC is spent on scanning
+  // the remembered sets (and many other components), so this thread constantly
+  // reevaluates the prediction for the remembered set scanning costs, and potentially
+  // G1Policy resizes the young gen. This may do a premature GC or even
+  // increase the young gen size to keep pause time length goal.
+  void sample_young_list_rs_length();
+
+  void run_service();
+  void check_for_periodic_gc();
+
+  void stop_service();
+
+  void sleep_before_next_cycle();
+
+  bool should_start_periodic_gc();
+
+public:
+  G1ServiceThread();
+  double vtime_accum() { return _vtime_accum; }
+};
+
+#endif // SHARE_GC_G1_G1SERVICETHREAD_HPP
--- a/src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.cpp	Tue Sep 01 13:35:47 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "gc/g1/g1CollectedHeap.inline.hpp"
-#include "gc/g1/g1CollectionSet.hpp"
-#include "gc/g1/g1ConcurrentMark.inline.hpp"
-#include "gc/g1/g1ConcurrentMarkThread.inline.hpp"
-#include "gc/g1/g1Policy.hpp"
-#include "gc/g1/g1YoungRemSetSamplingThread.hpp"
-#include "gc/g1/heapRegion.inline.hpp"
-#include "gc/g1/heapRegionRemSet.hpp"
-#include "gc/shared/suspendibleThreadSet.hpp"
-#include "memory/universe.hpp"
-#include "runtime/mutexLocker.hpp"
-
-G1YoungRemSetSamplingThread::G1YoungRemSetSamplingThread() :
-    ConcurrentGCThread(),
-    _monitor(Mutex::nonleaf,
-             "G1YoungRemSetSamplingThread monitor",
-             true,
-             Monitor::_safepoint_check_never),
-    _last_periodic_gc_attempt_s(os::elapsedTime()),
-    _vtime_accum(0) {
-  set_name("G1 Young RemSet Sampling");
-  create_and_start();
-}
-
-void G1YoungRemSetSamplingThread::sleep_before_next_cycle() {
-  MonitorLocker ml(&_monitor, Mutex::_no_safepoint_check_flag);
-  if (!should_terminate()) {
-    uintx waitms = G1ConcRefinementServiceIntervalMillis;
-    ml.wait(waitms);
-  }
-}
-
-bool G1YoungRemSetSamplingThread::should_start_periodic_gc() {
-  G1CollectedHeap* g1h = G1CollectedHeap::heap();
-  // If we are currently in a concurrent mark we are going to uncommit memory soon.
-  if (g1h->concurrent_mark()->cm_thread()->during_cycle()) {
-    log_debug(gc, periodic)("Concurrent cycle in progress. Skipping.");
-    return false;
-  }
-
-  // Check if enough time has passed since the last GC.
-  uintx time_since_last_gc = (uintx)g1h->time_since_last_collection().milliseconds();
-  if ((time_since_last_gc < G1PeriodicGCInterval)) {
-    log_debug(gc, periodic)("Last GC occurred " UINTX_FORMAT "ms before which is below threshold " UINTX_FORMAT "ms. Skipping.",
-                            time_since_last_gc, G1PeriodicGCInterval);
-    return false;
-  }
-
-  // Check if load is lower than max.
-  double recent_load;
-  if ((G1PeriodicGCSystemLoadThreshold > 0.0f) &&
-      (os::loadavg(&recent_load, 1) == -1 || recent_load > G1PeriodicGCSystemLoadThreshold)) {
-    log_debug(gc, periodic)("Load %1.2f is higher than threshold %1.2f. Skipping.",
-                            recent_load, G1PeriodicGCSystemLoadThreshold);
-    return false;
-  }
-
-  return true;
-}
-
-void G1YoungRemSetSamplingThread::check_for_periodic_gc(){
-  // If disabled, just return.
-  if (G1PeriodicGCInterval == 0) {
-    return;
-  }
-  if ((os::elapsedTime() - _last_periodic_gc_attempt_s) > (G1PeriodicGCInterval / 1000.0)) {
-    log_debug(gc, periodic)("Checking for periodic GC.");
-    if (should_start_periodic_gc()) {
-      if (!G1CollectedHeap::heap()->try_collect(GCCause::_g1_periodic_collection)) {
-        log_debug(gc, periodic)("GC request denied. Skipping.");
-      }
-    }
-    _last_periodic_gc_attempt_s = os::elapsedTime();
-  }
-}
-
-void G1YoungRemSetSamplingThread::run_service() {
-  double vtime_start = os::elapsedVTime();
-
-  while (!should_terminate()) {
-    sample_young_list_rs_length();
-
-    if (os::supports_vtime()) {
-      _vtime_accum = (os::elapsedVTime() - vtime_start);
-    } else {
-      _vtime_accum = 0.0;
-    }
-
-    check_for_periodic_gc();
-
-    sleep_before_next_cycle();
-  }
-}
-
-void G1YoungRemSetSamplingThread::stop_service() {
-  MutexLocker x(&_monitor, Mutex::_no_safepoint_check_flag);
-  _monitor.notify();
-}
-
-class G1YoungRemSetSamplingClosure : public HeapRegionClosure {
-  SuspendibleThreadSetJoiner* _sts;
-  size_t _regions_visited;
-  size_t _sampled_rs_length;
-public:
-  G1YoungRemSetSamplingClosure(SuspendibleThreadSetJoiner* sts) :
-    HeapRegionClosure(), _sts(sts), _regions_visited(0), _sampled_rs_length(0) { }
-
-  virtual bool do_heap_region(HeapRegion* r) {
-    size_t rs_length = r->rem_set()->occupied();
-    _sampled_rs_length += rs_length;
-
-    // Update the collection set policy information for this region
-    G1CollectedHeap::heap()->collection_set()->update_young_region_prediction(r, rs_length);
-
-    _regions_visited++;
-
-    if (_regions_visited == 10) {
-      if (_sts->should_yield()) {
-        _sts->yield();
-        // A gc may have occurred and our sampling data is stale and further
-        // traversal of the collection set is unsafe
-        return true;
-      }
-      _regions_visited = 0;
-    }
-    return false;
-  }
-
-  size_t sampled_rs_length() const { return _sampled_rs_length; }
-};
-
-void G1YoungRemSetSamplingThread::sample_young_list_rs_length() {
-  SuspendibleThreadSetJoiner sts;
-  G1CollectedHeap* g1h = G1CollectedHeap::heap();
-  G1Policy* policy = g1h->policy();
-
-  if (policy->use_adaptive_young_list_length()) {
-    G1YoungRemSetSamplingClosure cl(&sts);
-
-    G1CollectionSet* g1cs = g1h->collection_set();
-    g1cs->iterate(&cl);
-
-    if (cl.is_complete()) {
-      policy->revise_young_list_target_length_if_necessary(cl.sampled_rs_length());
-    }
-  }
-}
--- a/src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.hpp	Tue Sep 01 13:35:47 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_GC_G1_G1YOUNGREMSETSAMPLINGTHREAD_HPP
-#define SHARE_GC_G1_G1YOUNGREMSETSAMPLINGTHREAD_HPP
-
-#include "gc/shared/concurrentGCThread.hpp"
-
-// The G1YoungRemSetSamplingThread is used to re-assess the validity of
-// the prediction for the remembered set lengths of the young generation.
-//
-// At the end of the GC G1 determines the length of the young gen based on
-// how much time the next GC can take, and when the next GC may occur
-// according to the MMU.
-//
-// The assumption is that a significant part of the GC is spent on scanning
-// the remembered sets (and many other components), so this thread constantly
-// reevaluates the prediction for the remembered set scanning costs, and potentially
-// G1Policy resizes the young gen. This may do a premature GC or even
-// increase the young gen size to keep pause time length goal.
-class G1YoungRemSetSamplingThread: public ConcurrentGCThread {
-private:
-  Monitor _monitor;
-
-  double _last_periodic_gc_attempt_s;
-
-  double _vtime_accum;  // Accumulated virtual time.
-
-  void sample_young_list_rs_length();
-
-  void run_service();
-  void check_for_periodic_gc();
-
-  void stop_service();
-
-  void sleep_before_next_cycle();
-
-  bool should_start_periodic_gc();
-
-public:
-  G1YoungRemSetSamplingThread();
-  double vtime_accum() { return _vtime_accum; }
-};
-
-#endif // SHARE_GC_G1_G1YOUNGREMSETSAMPLINGTHREAD_HPP
--- a/src/hotspot/share/gc/g1/g1_globals.hpp	Tue Sep 01 13:35:47 2020 +0000
+++ b/src/hotspot/share/gc/g1/g1_globals.hpp	Tue Sep 01 15:55:56 2020 +0200
@@ -131,8 +131,8 @@
           range(0, max_intx)                                                \
                                                                             \
   product(uintx, G1ConcRefinementServiceIntervalMillis, 300,                \
-          "The last concurrent refinement thread wakes up every "           \
-          "specified number of milliseconds to do miscellaneous work.")     \
+          "The G1 service thread wakes up every specified number of "       \
+          "milliseconds to do miscellaneous work.")                         \
           range(0, max_jint)                                                \
                                                                             \
   product(size_t, G1ConcRefinementThresholdStep, 2,                         \