[8u] RFR (XS) 8130308: Too low memory usage in TestPromotionFromSurvivorToTenuredAfterMinorGC.java

Aleksey Shipilev shade at redhat.com
Mon Mar 1 18:19:14 UTC 2021


Original change:
   https://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/1facc49c0499
   https://bugs.openjdk.java.net/browse/JDK-8130308

In some of our 8u testing, we see the similar test failure. Making the test more reliable helps. 
The patch does not apply cleanly, because there is no @ignore line in 8u (which is why the test runs 
at all).

8u variant is the actual fix hunk:

diff -r af8aba9ce33a test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java
--- a/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java     Tue Feb 02 
19:20:19 2021 +0000
+++ b/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java     Mon Mar 01 
19:19:00 2021 +0100
@@ -94,13 +94,20 @@
          expectedMemoryUsage += SurvivorAlignmentTestMain.getAlignmentHelper(
                  SurvivorAlignmentTestMain.HeapSpace.TENURED)
                  .getActualMemoryUsage();

          test.allocate();
-        for (int i = 0; i <= SurvivorAlignmentTestMain.MAX_TENURING_THRESHOLD;
-             i++) {
+        for (int i = 0; i <= SurvivorAlignmentTestMain.MAX_TENURING_THRESHOLD; i++) {
              SurvivorAlignmentTestMain.WHITE_BOX.youngGC();
          }

+        // Sometimes we see that data unrelated to the test has been allocated during
+        // the loop. This data is included in the expectedMemoryUsage since we look
+        // through all threads to see what they allocated. If this data is still in
+        // the survivor area however, it should not be included in expectedMemoryUsage
+        // since the verification below only look at what's in tenured space.
+        expectedMemoryUsage -= SurvivorAlignmentTestMain.getAlignmentHelper(
+                                   SurvivorAlignmentTestMain.HeapSpace.SURVIVOR)
+                                   .getActualMemoryUsage();
          test.verifyMemoryUsage(expectedMemoryUsage);
      }
  }

Testing: affected test

-- 
Thanks,
-Aleksey



More information about the jdk8u-dev mailing list