RFC: Draft patch for JDK-8225216

Nilsen, Kelvin kdnilsen at amazon.com
Wed Mar 11 20:23:29 UTC 2020


The original problem report is available at https://bugs.openjdk.java.net/browse/JDK-8225216

I have confirmed that, with this patch, I can build the patched tip and the patched tip succeeds when I run jtreg with the following options:
 
 $ make run-test TEST=hotspot_gc_shenandoah

The newly fixed test is also successfully exercised by the following command:

            $ JT_JAVA=/Users/kdnilsen/jdk-13.0.1.jdk/Contents/Home \
               ~/src/jtreg/jtreg/build/images/jtreg/bin/jtreg \
               -jdk:./build/macosx-x86_64-server-release/images/jdk \
               -javaoption:-XX:+UnlockExperimentalVMOptions \
               -javaoption:-XX:+UseShenandoahGC \
               -vmoptions:-showversion -dir:./test -verbose:summary hotspot/jtreg
  
The draft patch consists of the following.   I am not authorized to directly apply this patch, so will need a "sponsor" to apply the patch when it is judged ready.

--- old/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp	2020-03-11 13:20:12.000000000 -0700
+++ new/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp	2020-03-11 13:20:12.000000000 -0700
@@ -178,6 +178,10 @@
     if (gc_requested) {
       heap->reset_bytes_allocated_since_gc_start();
 
+      // The default no-arg constructor for metaspace::MetaspaceSizesSnapshot
+      // captures the current state of metaspace memory.
+      metaspace::MetaspaceSizesSnapshot meta_sizes;
+
       // If GC was requested, we are sampling the counters even without actual triggers
       // from allocation machinery. This captures GC phases more accurately.
       set_forced_counters_update(true);
@@ -187,28 +191,24 @@
         ShenandoahHeapLocker locker(heap->lock());
         heap->free_set()->log_status();
       }
-    }
 
-    switch (mode) {
-      case none:
-        break;
-      case concurrent_traversal:
-        service_concurrent_traversal_cycle(cause);
-        break;
-      case concurrent_normal:
-        service_concurrent_normal_cycle(cause);
-        break;
-      case stw_degenerated:
-        service_stw_degenerated_cycle(cause, degen_point);
-        break;
-      case stw_full:
-        service_stw_full_cycle(cause);
-        break;
-      default:
-        ShouldNotReachHere();
-    }
+      switch (mode) {
+        case concurrent_traversal:
+          service_concurrent_traversal_cycle(cause);
+          break;
+        case concurrent_normal:
+          service_concurrent_normal_cycle(cause);
+          break;
+        case stw_degenerated:
+          service_stw_degenerated_cycle(cause, degen_point);
+          break;
+        case stw_full:
+          service_stw_full_cycle(cause);
+          break;
+        default:
+          ShouldNotReachHere();
+      }
 
-    if (gc_requested) {
       // If this was the requested GC cycle, notify waiters about it
       if (explicit_gc_requested || implicit_gc_requested) {
         notify_gc_waiters();
@@ -244,6 +244,8 @@
         heuristics->clear_metaspace_oom();
       }
 
+      MetaspaceUtils::print_metaspace_change(meta_sizes);
+
       // GC is over, we are at idle now
       if (ShenandoahPacing) {
         heap->pacer()->setup_for_idle();
--- old/test/hotspot/jtreg/TEST.groups	2020-03-11 13:20:14.000000000 -0700
+++ new/test/hotspot/jtreg/TEST.groups	2020-03-11 13:20:13.000000000 -0700
@@ -243,6 +243,7 @@
   gc/ergonomics/TestInitialGCThreadLogging.java \
   gc/ergonomics/TestDynamicNumberOfGCThreads.java \
   gc/logging/TestGCId.java \
+  gc/logging/TestMetaSpaceLog.java \
   gc/metaspace/TestMetaspacePerfCounters.java \
   gc/metaspace/TestMetaspacePerfCounters.java \
   gc/startup_warnings/TestShenandoah.java \
--- old/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java	2020-03-11 13:20:15.000000000 -0700
+++ new/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java	2020-03-11 13:20:14.000000000 -0700
@@ -45,7 +45,6 @@
  *          java.management
  * @requires vm.gc != "Epsilon"
  * @requires vm.gc != "Z"
- * @requires vm.gc != "Shenandoah"
  *
  * @compile TestMetaSpaceLog.java
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox



More information about the shenandoah-dev mailing list