changeset 58817:5393acb9f896

8241142: Shenandoah: should not use parallel reference processing with single GC thread Reviewed-by: shade Contributed-by: Aditya Mandaleeka <adityam@microsoft.com>
author shade
date Tue, 14 Apr 2020 21:17:48 +0200
parents adfb8ad070d5
children 234f63305533
files src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Tue Apr 14 20:36:33 2020 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Tue Apr 14 21:17:48 2020 +0200
@@ -487,7 +487,6 @@
   _heap = this;
 
   log_info(gc, init)("GC threads: " UINT32_FORMAT " parallel, " UINT32_FORMAT " concurrent", ParallelGCThreads, ConcGCThreads);
-  log_info(gc, init)("Reference processing: %s", ParallelRefProcEnabled ? "parallel" : "serial");
 
   BarrierSet::set_barrier_set(new ShenandoahBarrierSet(this));
 
@@ -2026,16 +2025,23 @@
 void ShenandoahHeap::ref_processing_init() {
   assert(_max_workers > 0, "Sanity");
 
+  bool mt_processing = ParallelRefProcEnabled && (ParallelGCThreads > 1);
+  bool mt_discovery = _max_workers > 1;
+
   _ref_processor =
     new ReferenceProcessor(&_subject_to_discovery,  // is_subject_to_discovery
-                           ParallelRefProcEnabled,  // MT processing
+                           mt_processing,           // MT processing
                            _max_workers,            // Degree of MT processing
-                           true,                    // MT discovery
+                           mt_discovery,            // MT discovery
                            _max_workers,            // Degree of MT discovery
                            false,                   // Reference discovery is not atomic
                            NULL,                    // No closure, should be installed before use
                            true);                   // Scale worker threads
 
+  log_info(gc, init)("Reference processing: %s discovery, %s processing",
+          mt_discovery ? "parallel" : "serial",
+          mt_processing ? "parallel" : "serial");
+
   shenandoah_assert_rp_isalive_not_installed();
 }