changeset 58392:367b1f73904c

8231668: Remove ForceDynamicNumberOfGCThreads Reviewed-by: shade, tschatzl Contributed-by: Aditya Mandaleeka <adityam@microsoft.com>
author shade
date Fri, 13 Mar 2020 13:22:39 +0100
parents de9c1fe3de60
children 3179efca4758
files src/hotspot/share/gc/g1/g1ConcurrentMark.cpp src/hotspot/share/gc/shared/gc_globals.hpp src/hotspot/share/gc/shared/workerPolicy.cpp src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp test/hotspot/jtreg/gc/ergonomics/TestDynamicNumberOfGCThreads.java test/hotspot/jtreg/gc/shenandoah/TestGCThreadGroups.java
diffstat 6 files changed, 10 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Fri Mar 13 11:54:47 2020 +0100
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Fri Mar 13 13:22:39 2020 +0100
@@ -862,9 +862,7 @@
 
 uint G1ConcurrentMark::calc_active_marking_workers() {
   uint result = 0;
-  if (!UseDynamicNumberOfGCThreads ||
-      (!FLAG_IS_DEFAULT(ConcGCThreads) &&
-       !ForceDynamicNumberOfGCThreads)) {
+  if (!UseDynamicNumberOfGCThreads || !FLAG_IS_DEFAULT(ConcGCThreads)) {
     result = _max_concurrent_workers;
   } else {
     result =
--- a/src/hotspot/share/gc/shared/gc_globals.hpp	Fri Mar 13 11:54:47 2020 +0100
+++ b/src/hotspot/share/gc/shared/gc_globals.hpp	Fri Mar 13 13:22:39 2020 +0100
@@ -187,10 +187,6 @@
              "Inject thread creation failures for "                         \
              "UseDynamicNumberOfGCThreads")                                 \
                                                                             \
-  diagnostic(bool, ForceDynamicNumberOfGCThreads, false,                    \
-          "Force dynamic selection of the number of "                       \
-          "parallel threads parallel gc will use to aid debugging")         \
-                                                                            \
   product(size_t, HeapSizePerGCThread, ScaleForWordSize(32*M),              \
           "Size of heap (bytes) per GC thread used in calculating the "     \
           "number of GC threads")                                           \
--- a/src/hotspot/share/gc/shared/workerPolicy.cpp	Fri Mar 13 11:54:47 2020 +0100
+++ b/src/hotspot/share/gc/shared/workerPolicy.cpp	Fri Mar 13 13:22:39 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -30,7 +30,6 @@
 #include "runtime/os.inline.hpp"
 #include "runtime/vm_version.hpp"
 
-bool WorkerPolicy::_debug_perturbation = false;
 uint WorkerPolicy::_parallel_worker_threads = 0;
 bool WorkerPolicy::_parallel_worker_threads_initialized = false;
 
@@ -133,26 +132,6 @@
   assert(new_active_workers >= min_workers, "Minimum workers not observed");
   assert(new_active_workers <= total_workers, "Total workers not observed");
 
-  if (ForceDynamicNumberOfGCThreads) {
-    // Assume this is debugging and jiggle the number of GC threads.
-    if (new_active_workers == prev_active_workers) {
-      if (new_active_workers < total_workers) {
-        new_active_workers++;
-      } else if (new_active_workers > min_workers) {
-        new_active_workers--;
-      }
-    }
-    if (new_active_workers == total_workers) {
-      if (_debug_perturbation) {
-        new_active_workers =  min_workers;
-      }
-      _debug_perturbation = !_debug_perturbation;
-    }
-    assert((new_active_workers <= ParallelGCThreads) &&
-           (new_active_workers >= min_workers),
-           "Jiggled active workers too much");
-  }
-
   log_trace(gc, task)("WorkerPolicy::calc_default_active_workers() : "
     "active_workers(): " UINTX_FORMAT "  new_active_workers: " UINTX_FORMAT "  "
     "prev_active_workers: " UINTX_FORMAT "\n"
@@ -173,8 +152,7 @@
   // number of workers to all the workers.
 
   uint new_active_workers;
-  if (!UseDynamicNumberOfGCThreads ||
-     (!FLAG_IS_DEFAULT(ParallelGCThreads) && !ForceDynamicNumberOfGCThreads)) {
+  if (!UseDynamicNumberOfGCThreads || !FLAG_IS_DEFAULT(ParallelGCThreads)) {
     new_active_workers = total_workers;
   } else {
     uintx min_workers = (total_workers == 1) ? 1 : 2;
@@ -190,8 +168,7 @@
 uint WorkerPolicy::calc_active_conc_workers(uintx total_workers,
                                             uintx active_workers,
                                             uintx application_workers) {
-  if (!UseDynamicNumberOfGCThreads ||
-     (!FLAG_IS_DEFAULT(ConcGCThreads) && !ForceDynamicNumberOfGCThreads)) {
+  if (!UseDynamicNumberOfGCThreads || !FLAG_IS_DEFAULT(ConcGCThreads)) {
     return ConcGCThreads;
   } else {
     uint no_of_gc_threads = calc_default_active_workers(total_workers,
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Fri Mar 13 11:54:47 2020 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Fri Mar 13 13:22:39 2020 +0100
@@ -2333,16 +2333,14 @@
   assert(nworkers > 0 && nworkers <= max_workers(), "Sanity");
 
   if (ShenandoahSafepoint::is_at_shenandoah_safepoint()) {
-    if (UseDynamicNumberOfGCThreads ||
-        (FLAG_IS_DEFAULT(ParallelGCThreads) && ForceDynamicNumberOfGCThreads)) {
+    if (UseDynamicNumberOfGCThreads) {
       assert(nworkers <= ParallelGCThreads, "Cannot use more than it has");
     } else {
       // Use ParallelGCThreads inside safepoints
-      assert(nworkers == ParallelGCThreads, "Use ParalleGCThreads within safepoints");
+      assert(nworkers == ParallelGCThreads, "Use ParallelGCThreads within safepoints");
     }
   } else {
-    if (UseDynamicNumberOfGCThreads ||
-        (FLAG_IS_DEFAULT(ConcGCThreads) && ForceDynamicNumberOfGCThreads)) {
+    if (UseDynamicNumberOfGCThreads) {
       assert(nworkers <= ConcGCThreads, "Cannot use more than it has");
     } else {
       // Use ConcGCThreads outside safepoints
--- a/test/hotspot/jtreg/gc/ergonomics/TestDynamicNumberOfGCThreads.java	Fri Mar 13 11:54:47 2020 +0100
+++ b/test/hotspot/jtreg/gc/ergonomics/TestDynamicNumberOfGCThreads.java	Fri Mar 13 13:22:39 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -70,21 +70,13 @@
   }
 
   private static void testDynamicNumberOfGCThreads(String gcFlag) throws Exception {
-    // UseDynamicNumberOfGCThreads and TraceDynamicGCThreads enabled
+    // UseDynamicNumberOfGCThreads enabled
     String[] baseArgs = {"-XX:+UnlockExperimentalVMOptions", "-XX:+" + gcFlag, "-Xmx10M", "-XX:+UseDynamicNumberOfGCThreads", "-Xlog:gc+task=trace", GCTest.class.getName()};
 
     // Base test with gc and +UseDynamicNumberOfGCThreads:
     ProcessBuilder pb_enabled = ProcessTools.createJavaProcessBuilder(baseArgs);
     verifyDynamicNumberOfGCThreads(new OutputAnalyzer(pb_enabled.start()));
 
-    // Ensure it also works on uniprocessors or if user specifies -XX:ParallelGCThreads=1:
-    String[] extraArgs = {"-XX:+UnlockDiagnosticVMOptions", "-XX:+ForceDynamicNumberOfGCThreads", "-XX:ParallelGCThreads=1"};
-    String[] finalArgs = new String[baseArgs.length + extraArgs.length];
-    System.arraycopy(extraArgs, 0, finalArgs, 0,                extraArgs.length);
-    System.arraycopy(baseArgs,  0, finalArgs, extraArgs.length, baseArgs.length);
-    pb_enabled = ProcessTools.createJavaProcessBuilder(finalArgs);
-    verifyDynamicNumberOfGCThreads(new OutputAnalyzer(pb_enabled.start()));
-
     // Turn on parallel reference processing
     String[] parRefProcArg = {"-XX:+ParallelRefProcEnabled", "-XX:-ShowMessageBoxOnError"};
     String[] parRefArgs = new String[baseArgs.length + parRefProcArg.length];
--- a/test/hotspot/jtreg/gc/shenandoah/TestGCThreadGroups.java	Fri Mar 13 11:54:47 2020 +0100
+++ b/test/hotspot/jtreg/gc/shenandoah/TestGCThreadGroups.java	Fri Mar 13 13:22:39 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2017, 2020, Red Hat, Inc. 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
@@ -54,12 +54,6 @@
  *      TestGCThreadGroups
  *
  * @run main/othervm -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
- *      -XX:+UseShenandoahGC
- *      -XX:+ForceDynamicNumberOfGCThreads
- *      -Dtarget=1000
- *      TestGCThreadGroups
- *
- * @run main/othervm -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
  *      -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
  *      -XX:ConcGCThreads=2 -XX:ParallelGCThreads=4
  *      -Dtarget=1000