# HG changeset patch # User tschatzl # Date 1434706027 -7200 # Node ID e27de74354530a3c8be513d9cd8211b24767409e # Parent 0c3dcc865a1c887830dc6eddf92a6f71ca2cbe81 8078669: G1 applies SurvivorAlignmentInBytes to both survivor and old gen Summary: After refactoring of the relevant code in JDK-8060025 the survivor alignment had been applied to any allocation within PLABs. Only do that for survivor allocations again. Improve the related tests to have less variance. Reviewed-by: jmasa, fzhinkin diff -r 0c3dcc865a1c -r e27de7435453 hotspot/src/share/vm/gc/g1/g1Allocator.hpp --- a/hotspot/src/share/vm/gc/g1/g1Allocator.hpp Fri Jun 19 09:41:50 2015 +0200 +++ b/hotspot/src/share/vm/gc/g1/g1Allocator.hpp Fri Jun 19 11:27:07 2015 +0200 @@ -227,7 +227,7 @@ size_t word_sz, AllocationContext_t context) { G1PLAB* buffer = alloc_buffer(dest, context); - if (_survivor_alignment_bytes == 0) { + if (_survivor_alignment_bytes == 0 || !dest.is_young()) { return buffer->allocate(word_sz); } else { return buffer->allocate_aligned(word_sz, _survivor_alignment_bytes); diff -r 0c3dcc865a1c -r e27de7435453 hotspot/test/gc/survivorAlignment/TestAllocationInEden.java --- a/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java Fri Jun 19 09:41:50 2015 +0200 +++ b/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java Fri Jun 19 11:27:07 2015 +0200 @@ -35,42 +35,42 @@ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions - * -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB + * -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB -XX:-ResizePLAB * -XX:OldSize=128m -XX:MaxHeapSize=192m * -XX:-ExplicitGCInvokesConcurrent * TestAllocationInEden 10m 9 EDEN * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions - * -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB + * -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB -XX:-ResizePLAB * -XX:OldSize=128m -XX:MaxHeapSize=192m * -XX:-ExplicitGCInvokesConcurrent * TestAllocationInEden 10m 47 EDEN * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions - * -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB + * -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB -XX:-ResizePLAB * -XX:OldSize=128m -XX:MaxHeapSize=192m * -XX:-ExplicitGCInvokesConcurrent * TestAllocationInEden 10m 9 EDEN * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions - * -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB + * -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB -XX:-ResizePLAB * -XX:OldSize=128m -XX:MaxHeapSize=192m * -XX:-ExplicitGCInvokesConcurrent * TestAllocationInEden 10m 87 EDEN * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions - * -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB + * -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB -XX:-ResizePLAB * -XX:OldSize=128m -XX:MaxHeapSize=192m * -XX:-ExplicitGCInvokesConcurrent * TestAllocationInEden 10m 9 EDEN * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions - * -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB + * -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB -XX:-ResizePLAB * -XX:OldSize=128m -XX:MaxHeapSize=192m * -XX:-ExplicitGCInvokesConcurrent * TestAllocationInEden 10m 147 EDEN diff -r 0c3dcc865a1c -r e27de7435453 hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java --- a/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java Fri Jun 19 09:41:50 2015 +0200 +++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java Fri Jun 19 11:27:07 2015 +0200 @@ -36,42 +36,42 @@ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m * -XX:OldSize=32m -XX:MaxHeapSize=96m -XX:SurvivorRatio=1 - * -XX:-ExplicitGCInvokesConcurrent + * -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=32 * TestPromotionFromEdenToTenured 10m 9 TENURED * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m * -XX:OldSize=32m -XX:MaxHeapSize=96m -XX:SurvivorRatio=1 - * -XX:-ExplicitGCInvokesConcurrent + * -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=32 * TestPromotionFromEdenToTenured 10m 47 TENURED * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m * -XX:OldSize=32m -XX:MaxHeapSize=96m - * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent + * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=64 * TestPromotionFromEdenToTenured 10m 9 TENURED * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m * -XX:OldSize=32m -XX:MaxHeapSize=128m - * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent + * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=64 * TestPromotionFromEdenToTenured 10m 87 TENURED * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m * -XX:OldSize=32M -XX:MaxHeapSize=96m -XX:SurvivorRatio=1 - * -XX:-ExplicitGCInvokesConcurrent + * -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=128 * TestPromotionFromEdenToTenured 10m 9 TENURED * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m * -XX:OldSize=32m -XX:MaxHeapSize=96m -XX:SurvivorRatio=1 - * -XX:-ExplicitGCInvokesConcurrent + * -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=128 * TestPromotionFromEdenToTenured 10m 147 TENURED diff -r 0c3dcc865a1c -r e27de7435453 hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java --- a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java Fri Jun 19 09:41:50 2015 +0200 +++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java Fri Jun 19 11:27:07 2015 +0200 @@ -36,13 +36,13 @@ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m * -XX:OldSize=32m -XX:MaxHeapSize=160m - * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent + * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=32 * TestPromotionFromSurvivorToTenuredAfterFullGC 10m 9 TENURED * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m - * -XX:OldSize=32m -XX:MaxHeapSize=160m + * -XX:OldSize=32m -XX:MaxHeapSize=160m -XX:-ResizePLAB * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=32 @@ -51,14 +51,14 @@ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=200m -XX:MaxNewSize=200m * -XX:OldSize=32m -XX:MaxHeapSize=232m - * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent + * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=64 * TestPromotionFromSurvivorToTenuredAfterFullGC 10m 9 TENURED * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m * -XX:OldSize=32m -XX:MaxHeapSize=160m - * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent + * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=64 * TestPromotionFromSurvivorToTenuredAfterFullGC 20m 87 @@ -66,7 +66,7 @@ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=256m -XX:MaxNewSize=256m * -XX:OldSize=32M -XX:MaxHeapSize=288m - * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent + * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=128 * TestPromotionFromSurvivorToTenuredAfterFullGC 10m 9 @@ -74,7 +74,7 @@ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m * -XX:OldSize=32m -XX:MaxHeapSize=160m - * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent + * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=128 * TestPromotionFromSurvivorToTenuredAfterFullGC 20m 147 diff -r 0c3dcc865a1c -r e27de7435453 hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java --- a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java Fri Jun 19 09:41:50 2015 +0200 +++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java Fri Jun 19 11:27:07 2015 +0200 @@ -36,7 +36,7 @@ * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m - * -XX:OldSize=32M -XX:MaxHeapSize=160m -XX:SurvivorRatio=1 + * -XX:OldSize=32M -XX:MaxHeapSize=160m -XX:SurvivorRatio=1 -XX:-ResizePLAB * -XX:-ExplicitGCInvokesConcurrent * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=32 @@ -44,7 +44,7 @@ * TENURED * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m - * -XX:OldSize=32M -XX:MaxHeapSize=160m -XX:SurvivorRatio=1 + * -XX:OldSize=32M -XX:MaxHeapSize=160m -XX:SurvivorRatio=1 -XX:-ResizePLAB * -XX:-ExplicitGCInvokesConcurrent * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=32 @@ -52,7 +52,7 @@ * TENURED * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=200m -XX:MaxNewSize=200m - * -XX:OldSize=32M -XX:MaxHeapSize=232m -XX:SurvivorRatio=1 + * -XX:OldSize=32M -XX:MaxHeapSize=232m -XX:SurvivorRatio=1 -XX:-ResizePLAB * -XX:-ExplicitGCInvokesConcurrent * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=64 @@ -60,7 +60,7 @@ * TENURED * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m - * -XX:OldSize=32M -XX:MaxHeapSize=160m -XX:SurvivorRatio=1 + * -XX:OldSize=32M -XX:MaxHeapSize=160m -XX:SurvivorRatio=1 -XX:-ResizePLAB * -XX:-ExplicitGCInvokesConcurrent * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=64 @@ -68,7 +68,7 @@ * TENURED * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=256m -XX:MaxNewSize=256m - * -XX:OldSize=32M -XX:MaxHeapSize=288m -XX:SurvivorRatio=1 + * -XX:OldSize=32M -XX:MaxHeapSize=288m -XX:SurvivorRatio=1 -XX:-ResizePLAB * -XX:-ExplicitGCInvokesConcurrent * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=128 @@ -76,7 +76,7 @@ * TENURED * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m - * -XX:OldSize=32M -XX:MaxHeapSize=160m -XX:SurvivorRatio=1 + * -XX:OldSize=32M -XX:MaxHeapSize=160m -XX:SurvivorRatio=1 -XX:-ResizePLAB * -XX:-ExplicitGCInvokesConcurrent * -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=128 diff -r 0c3dcc865a1c -r e27de7435453 hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java --- a/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java Fri Jun 19 09:41:50 2015 +0200 +++ b/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java Fri Jun 19 11:27:07 2015 +0200 @@ -37,37 +37,37 @@ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=32 -XX:OldSize=128m - * -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent + * -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * TestPromotionToSurvivor 10m 9 SURVIVOR * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=32 -XX:OldSize=128m - * -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent + * -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * TestPromotionToSurvivor 20m 47 SURVIVOR * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=64 -XX:OldSize=128m - * -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent + * -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * TestPromotionToSurvivor 8m 9 SURVIVOR * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=64 -XX:OldSize=128m - * -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent + * -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * TestPromotionToSurvivor 20m 87 SURVIVOR * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=256m -XX:MaxNewSize=256m * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=128 -XX:OldSize=128m - * -XX:MaxHeapSize=384m -XX:-ExplicitGCInvokesConcurrent + * -XX:MaxHeapSize=384m -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * TestPromotionToSurvivor 10m 9 SURVIVOR * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions * -XX:SurvivorAlignmentInBytes=128 -XX:OldSize=128m - * -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent + * -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent -XX:-ResizePLAB * TestPromotionToSurvivor 20m 147 SURVIVOR */ public class TestPromotionToSurvivor {