mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
8261230: GC tracing of page sizes are wrong in a few places
Reviewed-by: ayang, stuefe
This commit is contained in:
parent
40ae9937a0
commit
9f81ca8175
4 changed files with 47 additions and 8 deletions
|
@ -49,9 +49,40 @@ public class TestLargePageUseForAuxMemory {
|
|||
static long smallPageSize;
|
||||
static long allocGranularity;
|
||||
|
||||
static void checkSize(OutputAnalyzer output, long expectedSize, String pattern) {
|
||||
String pageSizeStr = output.firstMatch(pattern, 1);
|
||||
static boolean largePagesEnabled(OutputAnalyzer output) {
|
||||
// The gc+init logging includes information about large pages.
|
||||
String lp = output.firstMatch("Large Page Support: (\\w*)", 1);
|
||||
return lp != null && lp.equals("Enabled");
|
||||
}
|
||||
|
||||
static boolean largePagesAllocationFailure(OutputAnalyzer output, String pattern) {
|
||||
// Check if there is a large page failure associated with the data structure
|
||||
// being checked. In case of a large page allocation failure the output will
|
||||
// include logs like this for the affected data structure:
|
||||
// [0.048s][debug][gc,heap,coops] Reserve regular memory without large pages
|
||||
// [0.048s][info ][pagesize ] Next Bitmap: ... page_size=4K ...
|
||||
//
|
||||
// The pattern passed in should match the second line.
|
||||
String failureMatch = output.firstMatch("Reserve regular memory without large pages\\n.*" + pattern, 1);
|
||||
if (failureMatch != null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void checkSize(OutputAnalyzer output, long expectedSize, String pattern) {
|
||||
// First check the output for any large page allocation failure associated with
|
||||
// the checked data structure. If we detect a failure then expect small pages.
|
||||
if (largePagesAllocationFailure(output, pattern)) {
|
||||
// This should only happen when we are expecting large pages
|
||||
if (expectedSize == smallPageSize) {
|
||||
throw new RuntimeException("Expected small page size when large page failure was detected");
|
||||
}
|
||||
expectedSize = smallPageSize;
|
||||
}
|
||||
|
||||
// Now check what page size is traced.
|
||||
String pageSizeStr = output.firstMatch(pattern, 1);
|
||||
if (pageSizeStr == null) {
|
||||
output.reportDiagnosticSummary();
|
||||
throw new RuntimeException("Match from '" + pattern + "' got 'null' expected: " + expectedSize);
|
||||
|
@ -82,15 +113,21 @@ public class TestLargePageUseForAuxMemory {
|
|||
pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
|
||||
"-XX:G1HeapRegionSize=" + HEAP_REGION_SIZE,
|
||||
"-Xmx" + heapsize,
|
||||
"-Xlog:pagesize",
|
||||
"-Xlog:pagesize,gc+init,gc+heap+coops=debug",
|
||||
"-XX:+UseLargePages",
|
||||
"-XX:+IgnoreUnrecognizedVMOptions", // there is no ObjectAlignmentInBytes in 32 bit builds
|
||||
"-XX:ObjectAlignmentInBytes=8",
|
||||
"-version");
|
||||
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
checkSmallTables(output, (cardsShouldUseLargePages ? largePageSize : smallPageSize));
|
||||
checkBitmaps(output, (bitmapShouldUseLargePages ? largePageSize : smallPageSize));
|
||||
// Only expect large page size if large pages are enabled.
|
||||
if (largePagesEnabled(output)) {
|
||||
checkSmallTables(output, (cardsShouldUseLargePages ? largePageSize : smallPageSize));
|
||||
checkBitmaps(output, (bitmapShouldUseLargePages ? largePageSize : smallPageSize));
|
||||
} else {
|
||||
checkSmallTables(output, smallPageSize);
|
||||
checkBitmaps(output, smallPageSize);
|
||||
}
|
||||
output.shouldHaveExitValue(0);
|
||||
|
||||
// Test with large page disabled.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue