8231489: GC watermark_0_1 failed due to "metaspace.gc.Fault: GC has happened too rare"
authorpliden
Wed, 09 Oct 2019 08:09:12 +0200
changeset 58511 eb68d459ba6a
parent 58510 23a06a5eeddd
child 58512 5185bc8dcbb1
8231489: GC watermark_0_1 failed due to "metaspace.gc.Fault: GC has happened too rare" Reviewed-by: tschatzl, sjohanss
test/hotspot/jtreg/vmTestbase/metaspace/gc/HighWaterMarkTest.java
test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_0_1/TestDescription.java
test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_10_20/TestDescription.java
test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_70_80/TestDescription.java
test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_99_100/TestDescription.java
test/jtreg-ext/requires/VMProps.java
--- a/test/hotspot/jtreg/vmTestbase/metaspace/gc/HighWaterMarkTest.java	Tue Oct 08 15:27:13 2019 -0700
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/gc/HighWaterMarkTest.java	Wed Oct 09 08:09:12 2019 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -42,8 +42,6 @@
  * Test verifies that MinMetaspaceFreeRatio/MaxMetaspaceFreeRatio settings
  * affect the frequency of GC. (High-water mark)
  *
- * Note: The test doesn't check the GC count if CMS is used.
- *
  * Quoting: Java SE 8 HotSpot[tm] Virtual Machine Garbage Collection Tuning
  * <pre>
  * Class metadata is deallocated when the corresponding Java class is unloaded.
@@ -175,11 +173,6 @@
             throw new Fault("Committed amount hasn't achieved " + bytes2k(committedLevel));
         }
 
-        if (VMRuntimeEnvUtils.isVMOptionEnabled("UseConcMarkSweepGC")) {
-            System.out.println("ConcMarkSweep is used, cannot count GC");
-            return;
-        }
-
         int gcCount = getMetaspaceGCCount();
         if (gcCount < 0) {
             // perhpas, it's better to silently pass here... Let's see.
--- a/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_0_1/TestDescription.java	Tue Oct 08 15:27:13 2019 -0700
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_0_1/TestDescription.java	Wed Oct 09 08:09:12 2019 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -29,6 +29,11 @@
  * @summary converted from VM Testbase metaspace/gc/watermark_0_1.
  * VM Testbase keywords: [nonconcurrent, no_cds]
  *
+ * @comment Don't run test in configurations where we can't reliably count number of metaspace triggered GCs
+ * @requires vm.gc != null | !vm.opt.final.ClassUnloadingWithConcurrentMark
+ * @requires vm.gc != "G1" | !vm.opt.final.ClassUnloadingWithConcurrentMark
+ * @requires vm.gc != "ConcMarkSweep"
+ * @requires vm.gc != "Z"
  * @library /vmTestbase /test/lib
  * @run driver jdk.test.lib.FileInstaller . .
  * @run main/othervm
--- a/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_10_20/TestDescription.java	Tue Oct 08 15:27:13 2019 -0700
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_10_20/TestDescription.java	Wed Oct 09 08:09:12 2019 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -29,6 +29,11 @@
  * @summary converted from VM Testbase metaspace/gc/watermark_10_20.
  * VM Testbase keywords: [nonconcurrent, no_cds]
  *
+ * @comment Don't run test in configurations where we can't reliably count number of metaspace triggered GCs
+ * @requires vm.gc != null | !vm.opt.final.ClassUnloadingWithConcurrentMark
+ * @requires vm.gc != "G1" | !vm.opt.final.ClassUnloadingWithConcurrentMark
+ * @requires vm.gc != "ConcMarkSweep"
+ * @requires vm.gc != "Z"
  * @library /vmTestbase /test/lib
  * @run driver jdk.test.lib.FileInstaller . .
  * @run main/othervm
--- a/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_70_80/TestDescription.java	Tue Oct 08 15:27:13 2019 -0700
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_70_80/TestDescription.java	Wed Oct 09 08:09:12 2019 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -29,6 +29,11 @@
  * @summary converted from VM Testbase metaspace/gc/watermark_70_80.
  * VM Testbase keywords: [nonconcurrent, no_cds]
  *
+ * @comment Don't run test in configurations where we can't reliably count number of metaspace triggered GCs
+ * @requires vm.gc != null | !vm.opt.final.ClassUnloadingWithConcurrentMark
+ * @requires vm.gc != "G1" | !vm.opt.final.ClassUnloadingWithConcurrentMark
+ * @requires vm.gc != "ConcMarkSweep"
+ * @requires vm.gc != "Z"
  * @library /vmTestbase /test/lib
  * @run driver jdk.test.lib.FileInstaller . .
  * @run main/othervm
--- a/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_99_100/TestDescription.java	Tue Oct 08 15:27:13 2019 -0700
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_99_100/TestDescription.java	Wed Oct 09 08:09:12 2019 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -29,6 +29,11 @@
  * @summary converted from VM Testbase metaspace/gc/watermark_99_100.
  * VM Testbase keywords: [nonconcurrent, no_cds]
  *
+ * @comment Don't run test in configurations where we can't reliably count number of metaspace triggered GCs
+ * @requires vm.gc != null | !vm.opt.final.ClassUnloadingWithConcurrentMark
+ * @requires vm.gc != "G1" | !vm.opt.final.ClassUnloadingWithConcurrentMark
+ * @requires vm.gc != "ConcMarkSweep"
+ * @requires vm.gc != "Z"
  * @library /vmTestbase /test/lib
  * @run driver jdk.test.lib.FileInstaller . .
  * @run main/othervm
--- a/test/jtreg-ext/requires/VMProps.java	Tue Oct 08 15:27:13 2019 -0700
+++ b/test/jtreg-ext/requires/VMProps.java	Wed Oct 09 08:09:12 2019 +0200
@@ -305,6 +305,7 @@
      */
     protected void vmOptFinalFlags(SafeMap map) {
         vmOptFinalFlag(map, "ClassUnloading");
+        vmOptFinalFlag(map, "ClassUnloadingWithConcurrentMark");
         vmOptFinalFlag(map, "UseCompressedOops");
         vmOptFinalFlag(map, "EnableJVMCI");
         vmOptFinalFlag(map, "EliminateAllocations");