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
|
@ -1497,8 +1497,8 @@ G1RegionToSpaceMapper* G1CollectedHeap::create_aux_memory_mapper(const char* des
|
||||||
|
|
||||||
os::trace_page_sizes_for_requested_size(description,
|
os::trace_page_sizes_for_requested_size(description,
|
||||||
size,
|
size,
|
||||||
preferred_page_size,
|
|
||||||
page_size,
|
page_size,
|
||||||
|
preferred_page_size,
|
||||||
rs.base(),
|
rs.base(),
|
||||||
rs.size());
|
rs.size());
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,8 @@ ParMarkBitMap::initialize(MemRegion covered_region)
|
||||||
const size_t rs_align = page_sz == (size_t) os::vm_page_size() ? 0 :
|
const size_t rs_align = page_sz == (size_t) os::vm_page_size() ? 0 :
|
||||||
MAX2(page_sz, granularity);
|
MAX2(page_sz, granularity);
|
||||||
ReservedSpace rs(_reserved_byte_size, rs_align, rs_align > 0);
|
ReservedSpace rs(_reserved_byte_size, rs_align, rs_align > 0);
|
||||||
os::trace_page_sizes("Mark Bitmap", raw_bytes, raw_bytes, page_sz,
|
const size_t used_page_sz = ReservedSpace::actual_reserved_page_size(rs);
|
||||||
|
os::trace_page_sizes("Mark Bitmap", raw_bytes, raw_bytes, used_page_sz,
|
||||||
rs.base(), rs.size());
|
rs.base(), rs.size());
|
||||||
|
|
||||||
MemTracker::record_virtual_memory_type((address)rs.base(), mtGC);
|
MemTracker::record_virtual_memory_type((address)rs.base(), mtGC);
|
||||||
|
|
|
@ -172,11 +172,12 @@ ReservedHeapSpace GenCollectedHeap::allocate(size_t alignment) {
|
||||||
SIZE_FORMAT, total_reserved, alignment);
|
SIZE_FORMAT, total_reserved, alignment);
|
||||||
|
|
||||||
ReservedHeapSpace heap_rs = Universe::reserve_heap(total_reserved, alignment);
|
ReservedHeapSpace heap_rs = Universe::reserve_heap(total_reserved, alignment);
|
||||||
|
size_t used_page_size = ReservedSpace::actual_reserved_page_size(heap_rs);
|
||||||
|
|
||||||
os::trace_page_sizes("Heap",
|
os::trace_page_sizes("Heap",
|
||||||
MinHeapSize,
|
MinHeapSize,
|
||||||
total_reserved,
|
total_reserved,
|
||||||
alignment,
|
used_page_size,
|
||||||
heap_rs.base(),
|
heap_rs.base(),
|
||||||
heap_rs.size());
|
heap_rs.size());
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,40 @@ public class TestLargePageUseForAuxMemory {
|
||||||
static long smallPageSize;
|
static long smallPageSize;
|
||||||
static long allocGranularity;
|
static long allocGranularity;
|
||||||
|
|
||||||
static void checkSize(OutputAnalyzer output, long expectedSize, String pattern) {
|
static boolean largePagesEnabled(OutputAnalyzer output) {
|
||||||
String pageSizeStr = output.firstMatch(pattern, 1);
|
// 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) {
|
if (pageSizeStr == null) {
|
||||||
output.reportDiagnosticSummary();
|
output.reportDiagnosticSummary();
|
||||||
throw new RuntimeException("Match from '" + pattern + "' got 'null' expected: " + expectedSize);
|
throw new RuntimeException("Match from '" + pattern + "' got 'null' expected: " + expectedSize);
|
||||||
|
@ -82,15 +113,21 @@ public class TestLargePageUseForAuxMemory {
|
||||||
pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
|
pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
|
||||||
"-XX:G1HeapRegionSize=" + HEAP_REGION_SIZE,
|
"-XX:G1HeapRegionSize=" + HEAP_REGION_SIZE,
|
||||||
"-Xmx" + heapsize,
|
"-Xmx" + heapsize,
|
||||||
"-Xlog:pagesize",
|
"-Xlog:pagesize,gc+init,gc+heap+coops=debug",
|
||||||
"-XX:+UseLargePages",
|
"-XX:+UseLargePages",
|
||||||
"-XX:+IgnoreUnrecognizedVMOptions", // there is no ObjectAlignmentInBytes in 32 bit builds
|
"-XX:+IgnoreUnrecognizedVMOptions", // there is no ObjectAlignmentInBytes in 32 bit builds
|
||||||
"-XX:ObjectAlignmentInBytes=8",
|
"-XX:ObjectAlignmentInBytes=8",
|
||||||
"-version");
|
"-version");
|
||||||
|
|
||||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
|
// Only expect large page size if large pages are enabled.
|
||||||
|
if (largePagesEnabled(output)) {
|
||||||
checkSmallTables(output, (cardsShouldUseLargePages ? largePageSize : smallPageSize));
|
checkSmallTables(output, (cardsShouldUseLargePages ? largePageSize : smallPageSize));
|
||||||
checkBitmaps(output, (bitmapShouldUseLargePages ? largePageSize : smallPageSize));
|
checkBitmaps(output, (bitmapShouldUseLargePages ? largePageSize : smallPageSize));
|
||||||
|
} else {
|
||||||
|
checkSmallTables(output, smallPageSize);
|
||||||
|
checkBitmaps(output, smallPageSize);
|
||||||
|
}
|
||||||
output.shouldHaveExitValue(0);
|
output.shouldHaveExitValue(0);
|
||||||
|
|
||||||
// Test with large page disabled.
|
// Test with large page disabled.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue