hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java
author jprovino
Wed, 11 Nov 2015 23:47:42 +0000
changeset 33911 af2cff5bd523
parent 31968 1fd106275654
child 33730 30e064828045
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
     1
/*
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
     4
 *
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
     7
 * published by the Free Software Foundation.
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
     8
 *
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    13
 * accompanied this code).
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    14
 *
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    18
 *
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    21
 * questions.
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    22
 */
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    23
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    24
/*
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    25
 * @test TestLargePageUseForAuxMemory.java
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 30312
diff changeset
    26
 * @summary Test that auxiliary data structures are allocated using large pages if available.
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
    27
 * @bug 8058354 8079208
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    28
 * @key gc
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    29
 * @library /testlibrary /../../test/lib
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    30
 * @requires (vm.gc=="G1" | vm.gc=="null")
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 30312
diff changeset
    31
 * @build jdk.test.lib.* sun.hotspot.WhiteBox
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    32
 * @build TestLargePageUseForAuxMemory
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    33
 * @run main ClassFileInstaller sun.hotspot.WhiteBox
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    34
 *                              sun.hotspot.WhiteBox$WhiteBoxPermission
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    35
 * @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+WhiteBoxAPI -XX:+IgnoreUnrecognizedVMOptions -XX:+UseLargePages TestLargePageUseForAuxMemory
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    36
 */
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    37
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
    38
import java.lang.Math;
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
    39
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 30312
diff changeset
    40
import jdk.test.lib.*;
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
    41
import jdk.test.lib.Asserts;
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    42
import sun.hotspot.WhiteBox;
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    43
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    44
public class TestLargePageUseForAuxMemory {
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
    45
    static final long HEAP_REGION_SIZE = 1 * 1024 * 1024;
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    46
    static long largePageSize;
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    47
    static long smallPageSize;
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
    48
    static long allocGranularity;
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    49
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    50
    static void checkSmallTables(OutputAnalyzer output, long expectedPageSize) throws Exception {
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    51
        output.shouldContain("G1 'Block offset table': pg_sz=" + expectedPageSize);
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    52
        output.shouldContain("G1 'Card counts table': pg_sz=" + expectedPageSize);
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    53
    }
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    54
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    55
    static void checkBitmaps(OutputAnalyzer output, long expectedPageSize) throws Exception {
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    56
        output.shouldContain("G1 'Prev Bitmap': pg_sz=" + expectedPageSize);
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    57
        output.shouldContain("G1 'Next Bitmap': pg_sz=" + expectedPageSize);
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    58
    }
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    59
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
    60
    static void testVM(String what, long heapsize, boolean cardsShouldUseLargePages, boolean bitmapShouldUseLargePages) throws Exception {
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
    61
        System.out.println(what + " heapsize " + heapsize + " card table should use large pages " + cardsShouldUseLargePages + " " +
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
    62
                           "bitmaps should use large pages " + bitmapShouldUseLargePages);
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    63
        ProcessBuilder pb;
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    64
        // Test with large page enabled.
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    65
        pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    66
                                                   "-XX:G1HeapRegionSize=" + HEAP_REGION_SIZE,
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
    67
                                                   "-Xms" + heapsize,
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    68
                                                   "-Xmx" + heapsize,
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    69
                                                   "-XX:+TracePageSizes",
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    70
                                                   "-XX:+UseLargePages",
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
    71
                                                   "-XX:+IgnoreUnrecognizedVMOptions",  // there is no ObjectAlignmentInBytes in 32 bit builds
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    72
                                                   "-XX:ObjectAlignmentInBytes=8",
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    73
                                                   "-version");
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    74
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    75
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    76
        checkSmallTables(output, (cardsShouldUseLargePages ? largePageSize : smallPageSize));
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    77
        checkBitmaps(output, (bitmapShouldUseLargePages ? largePageSize : smallPageSize));
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    78
        output.shouldHaveExitValue(0);
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    79
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    80
        // Test with large page disabled.
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    81
        pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    82
                                                   "-XX:G1HeapRegionSize=" + HEAP_REGION_SIZE,
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
    83
                                                   "-Xms" + heapsize,
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    84
                                                   "-Xmx" + heapsize,
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    85
                                                   "-XX:+TracePageSizes",
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    86
                                                   "-XX:-UseLargePages",
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
    87
                                                   "-XX:+IgnoreUnrecognizedVMOptions",  // there is no ObjectAlignmentInBytes in 32 bit builds
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    88
                                                   "-XX:ObjectAlignmentInBytes=8",
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    89
                                                   "-version");
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    90
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    91
        output = new OutputAnalyzer(pb.start());
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    92
        checkSmallTables(output, smallPageSize);
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    93
        checkBitmaps(output, smallPageSize);
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    94
        output.shouldHaveExitValue(0);
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    95
    }
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
    96
31968
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
    97
    private static long gcd(long x, long y) {
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
    98
        while (x > 0) {
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
    99
            long t = x;
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   100
            x = y % x;
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   101
            y = t;
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   102
        }
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   103
        return y;
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   104
    }
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   105
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   106
    private static long lcm(long x, long y) {
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   107
        return x * (y / gcd(x, y));
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   108
    }
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   109
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   110
    public static void main(String[] args) throws Exception {
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   111
        if (!Platform.isDebugBuild()) {
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   112
            System.out.println("Skip tests on non-debug builds because the required option TracePageSizes is a debug-only option.");
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   113
            return;
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   114
        }
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   115
31968
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   116
        // Size that a single card covers.
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   117
        final int cardSize = 512;
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   118
        WhiteBox wb = WhiteBox.getWhiteBox();
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   119
        smallPageSize = wb.getVMPageSize();
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   120
        largePageSize = wb.getVMLargePageSize();
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
   121
        allocGranularity = wb.getVMAllocationGranularity();
31968
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   122
        final long heapAlignment = lcm(cardSize * smallPageSize, largePageSize);
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   123
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   124
        if (largePageSize == 0) {
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   125
            System.out.println("Skip tests because large page support does not seem to be available on this platform.");
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   126
            return;
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   127
        }
31968
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   128
        if (largePageSize == smallPageSize) {
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   129
            System.out.println("Skip tests because large page support does not seem to be available on this platform." +
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   130
                               "Small and large page size are the same.");
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   131
            return;
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   132
        }
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   133
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   134
        // To get large pages for the card table etc. we need at least a 1G heap (with 4k page size).
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   135
        // 32 bit systems will have problems reserving such an amount of contiguous space, so skip the
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   136
        // test there.
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   137
        if (!Platform.is32bit()) {
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   138
            final long heapSizeForCardTableUsingLargePages = largePageSize * cardSize;
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
   139
            final long heapSizeDiffForCardTable = Math.max(Math.max(allocGranularity * cardSize, HEAP_REGION_SIZE), largePageSize);
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   140
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
   141
            Asserts.assertGT(heapSizeForCardTableUsingLargePages, heapSizeDiffForCardTable,
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
   142
                             "To test we would require to use an invalid heap size");
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
   143
            testVM("case1: card table and bitmap use large pages (barely)", heapSizeForCardTableUsingLargePages, true, true);
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
   144
            testVM("case2: card table and bitmap use large pages (extra slack)", heapSizeForCardTableUsingLargePages + heapSizeDiffForCardTable, true, true);
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
   145
            testVM("case3: only bitmap uses large pages (barely not)", heapSizeForCardTableUsingLargePages - heapSizeDiffForCardTable, false, true);
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   146
        }
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   147
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   148
        // Minimum heap requirement to get large pages for bitmaps is 128M heap. This seems okay to test
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   149
        // everywhere.
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   150
        final int bitmapTranslationFactor = 8 * 8; // ObjectAlignmentInBytes * BitsPerByte
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   151
        final long heapSizeForBitmapUsingLargePages = largePageSize * bitmapTranslationFactor;
31968
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   152
        final long heapSizeDiffForBitmap = Math.max(Math.max(allocGranularity * bitmapTranslationFactor, HEAP_REGION_SIZE),
1fd106275654 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations
goetz
parents: 31392
diff changeset
   153
                                                    Math.max(largePageSize, heapAlignment));
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   154
31392
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
   155
        Asserts.assertGT(heapSizeForBitmapUsingLargePages, heapSizeDiffForBitmap,
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
   156
                         "To test we would require to use an invalid heap size");
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
   157
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
   158
        testVM("case4: only bitmap uses large pages (barely)", heapSizeForBitmapUsingLargePages, false, true);
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
   159
        testVM("case5: only bitmap uses large pages (extra slack)", heapSizeForBitmapUsingLargePages + heapSizeDiffForBitmap, false, true);
863f78743771 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 30604
diff changeset
   160
        testVM("case6: nothing uses large pages (barely not)", heapSizeForBitmapUsingLargePages - heapSizeDiffForBitmap, false, false);
30158
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   161
    }
bd6094906ef8 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents:
diff changeset
   162
}