10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test TestLargePageUseForAuxMemory.java 26 * @summary Test that auxiliary data structures are allocated using large pages if available. 27 * @bug 8058354 8079208 28 * @key gc 29 * @modules java.base/jdk.internal.misc 30 * @library /testlibrary /test/lib 31 * @requires vm.gc.G1 32 * @build jdk.test.lib.* sun.hotspot.WhiteBox 33 * @build TestLargePageUseForAuxMemory 34 * @run main ClassFileInstaller sun.hotspot.WhiteBox 35 * sun.hotspot.WhiteBox$WhiteBoxPermission 36 * @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+IgnoreUnrecognizedVMOptions -XX:+UseLargePages TestLargePageUseForAuxMemory 37 */ 38 39 import java.lang.Math; 40 import java.lang.reflect.InvocationTargetException; 41 import java.lang.reflect.Method; 42 43 import jdk.test.lib.*; 44 import jdk.test.lib.Asserts; 45 import sun.hotspot.WhiteBox; 46 47 public class TestLargePageUseForAuxMemory { 48 static final long HEAP_REGION_SIZE = 1 * 1024 * 1024; 49 static long largePageSize; 50 static long smallPageSize; 51 static long allocGranularity; 52 53 static void checkSize(OutputAnalyzer output, long expectedSize, String pattern) { 54 String pageSizeStr = output.firstMatch(pattern, 1); 55 56 if (pageSizeStr == null) { 57 output.reportDiagnosticSummary(); 58 throw new RuntimeException("Match from '" + pattern + "' got 'null' expected: " + expectedSize); 59 } 60 61 long size = parseMemoryString(pageSizeStr); 62 if (size != expectedSize) { 63 output.reportDiagnosticSummary(); 64 throw new RuntimeException("Match from '" + pattern + "' got " + size + " expected: " + expectedSize); | 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test TestLargePageUseForAuxMemory.java 26 * @summary Test that auxiliary data structures are allocated using large pages if available. 27 * @bug 8058354 8079208 28 * @key gc 29 * @modules java.base/jdk.internal.misc 30 * @library /test/lib 31 * @requires vm.gc.G1 32 * @build sun.hotspot.WhiteBox 33 * @run main ClassFileInstaller sun.hotspot.WhiteBox 34 * sun.hotspot.WhiteBox$WhiteBoxPermission 35 * @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+IgnoreUnrecognizedVMOptions -XX:+UseLargePages TestLargePageUseForAuxMemory 36 */ 37 38 import java.lang.Math; 39 import java.lang.reflect.InvocationTargetException; 40 import java.lang.reflect.Method; 41 42 import jdk.test.lib.process.OutputAnalyzer; 43 import jdk.test.lib.process.ProcessTools; 44 import jdk.test.lib.Asserts; 45 import jdk.test.lib.Platform; 46 import sun.hotspot.WhiteBox; 47 48 public class TestLargePageUseForAuxMemory { 49 static final long HEAP_REGION_SIZE = 1 * 1024 * 1024; 50 static long largePageSize; 51 static long smallPageSize; 52 static long allocGranularity; 53 54 static void checkSize(OutputAnalyzer output, long expectedSize, String pattern) { 55 String pageSizeStr = output.firstMatch(pattern, 1); 56 57 if (pageSizeStr == null) { 58 output.reportDiagnosticSummary(); 59 throw new RuntimeException("Match from '" + pattern + "' got 'null' expected: " + expectedSize); 60 } 61 62 long size = parseMemoryString(pageSizeStr); 63 if (size != expectedSize) { 64 output.reportDiagnosticSummary(); 65 throw new RuntimeException("Match from '" + pattern + "' got " + size + " expected: " + expectedSize); |