Skip to content

Commit

Permalink
8310107: os::trace_page_sizes_for_requested_size should name alignmen…
Browse files Browse the repository at this point in the history
…t as requested page size

Reviewed-by: stefank, dholmes
  • Loading branch information
tstuefe committed Jun 19, 2023
1 parent 02aaab1 commit 6473a7d
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 43 deletions.
8 changes: 4 additions & 4 deletions src/hotspot/share/gc/g1/g1CollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1307,10 +1307,10 @@ G1RegionToSpaceMapper* G1CollectedHeap::create_aux_memory_mapper(const char* des

os::trace_page_sizes_for_requested_size(description,
size,
page_size,
preferred_page_size,
rs.base(),
rs.size());
rs.size(),
page_size);

return result;
}
Expand Down Expand Up @@ -1400,9 +1400,9 @@ jint G1CollectedHeap::initialize() {
os::trace_page_sizes("Heap",
MinHeapSize,
reserved_byte_size,
page_size,
heap_rs.base(),
heap_rs.size());
heap_rs.size(),
page_size);
heap_storage->set_mapping_changed_listener(&_listener);

// Create storage for the BOT, card table and the bitmap.
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/parallel/parMarkBitMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ ParMarkBitMap::initialize(MemRegion covered_region)
MAX2(page_sz, granularity);
ReservedSpace rs(_reserved_byte_size, rs_align, page_sz);
const size_t used_page_sz = rs.page_size();
os::trace_page_sizes("Mark Bitmap", raw_bytes, raw_bytes, used_page_sz,
rs.base(), rs.size());
os::trace_page_sizes("Mark Bitmap", raw_bytes, raw_bytes,
rs.base(), rs.size(), used_page_sz);

MemTracker::record_virtual_memory_type((address)rs.base(), mtGC);

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,9 +785,9 @@ void ParallelScavengeHeap::trace_actual_reserved_page_size(const size_t reserved
os::trace_page_sizes("Heap",
MinHeapSize,
reserved_heap_size,
page_size,
rs.base(),
rs.size());
rs.size(),
page_size);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/parallel/psParallelCompact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ ParallelCompactData::create_vspace(size_t count, size_t element_size)
const size_t rs_align = page_sz == os::vm_page_size() ? 0 :
MAX2(page_sz, granularity);
ReservedSpace rs(_reserved_byte_size, rs_align, page_sz);
os::trace_page_sizes("Parallel Compact Data", raw_bytes, raw_bytes, page_sz, rs.base(),
rs.size());
os::trace_page_sizes("Parallel Compact Data", raw_bytes, raw_bytes, rs.base(),
rs.size(), page_sz);

MemTracker::record_virtual_memory_type((address)rs.base(), mtGC);

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/cardTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void CardTable::initialize(void* region0_start, void* region1_start) {
MemTracker::record_virtual_memory_type((address)heap_rs.base(), mtGC);

os::trace_page_sizes("Card Table", num_bytes, num_bytes,
_page_size, heap_rs.base(), heap_rs.size());
heap_rs.base(), heap_rs.size(), _page_size);
if (!heap_rs.is_reserved()) {
vm_exit_during_initialization("Could not reserve enough space for the "
"card marking array");
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shared/genCollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ ReservedHeapSpace GenCollectedHeap::allocate(size_t alignment) {
os::trace_page_sizes("Heap",
MinHeapSize,
total_reserved,
used_page_size,
heap_rs.base(),
heap_rs.size());
heap_rs.size(),
used_page_size);

return heap_rs;
}
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ bool JfrVirtualMemorySegment::initialize(size_t reservation_size_request_bytes)
assert(is_aligned(_rs.size(), os::vm_allocation_granularity()), "invariant");
os::trace_page_sizes("Jfr", reservation_size_request_bytes,
reservation_size_request_bytes,
os::vm_page_size(),
_rs.base(),
_rs.size());
_rs.size(),
os::vm_page_size());
MemTracker::record_virtual_memory_type((address)_rs.base(), mtTracing);
assert(is_aligned(_rs.base(), os::vm_page_size()), "invariant");
assert(is_aligned(_rs.size(), os::vm_page_size()), "invariant");
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/memory/heap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ bool CodeHeap::reserve(ReservedSpace rs, size_t committed_size, size_t segment_s
const size_t c_size = align_up(committed_size, page_size);
assert(c_size <= rs.size(), "alignment made committed size to large");

os::trace_page_sizes(_name, c_size, rs.size(), page_size,
rs.base(), rs.size());
os::trace_page_sizes(_name, c_size, rs.size(), rs.base(), rs.size(), page_size);
if (!_memory.initialize(rs, c_size)) {
return false;
}
Expand Down
30 changes: 15 additions & 15 deletions src/hotspot/share/runtime/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1655,43 +1655,43 @@ const char* os::errno_name(int e) {
void os::trace_page_sizes(const char* str,
const size_t region_min_size,
const size_t region_max_size,
const size_t page_size,
const char* base,
const size_t size) {
const size_t size,
const size_t page_size) {

log_info(pagesize)("%s: "
" min=" SIZE_FORMAT "%s"
" max=" SIZE_FORMAT "%s"
" base=" PTR_FORMAT
" page_size=" SIZE_FORMAT "%s"
" size=" SIZE_FORMAT "%s",
" size=" SIZE_FORMAT "%s"
" page_size=" SIZE_FORMAT "%s",
str,
trace_page_size_params(region_min_size),
trace_page_size_params(region_max_size),
p2i(base),
trace_page_size_params(page_size),
trace_page_size_params(size));
trace_page_size_params(size),
trace_page_size_params(page_size));
}

void os::trace_page_sizes_for_requested_size(const char* str,
const size_t requested_size,
const size_t page_size,
const size_t alignment,
const size_t requested_page_size,
const char* base,
const size_t size) {
const size_t size,
const size_t page_size) {

log_info(pagesize)("%s:"
" req_size=" SIZE_FORMAT "%s"
" req_page_size=" SIZE_FORMAT "%s"
" base=" PTR_FORMAT
" page_size=" SIZE_FORMAT "%s"
" alignment=" SIZE_FORMAT "%s"
" size=" SIZE_FORMAT "%s",
" size=" SIZE_FORMAT "%s"
" page_size=" SIZE_FORMAT "%s",
str,
trace_page_size_params(requested_size),
trace_page_size_params(requested_page_size),
p2i(base),
trace_page_size_params(page_size),
trace_page_size_params(alignment),
trace_page_size_params(size));
trace_page_size_params(size),
trace_page_size_params(page_size));
}


Expand Down
11 changes: 5 additions & 6 deletions src/hotspot/share/runtime/os.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,19 +405,18 @@ class os: AllStatic {
// passed to page_size_for_region() and page_size should be the result of that
// call. The (optional) base and size parameters should come from the
// ReservedSpace base() and size() methods.
static void trace_page_sizes(const char* str, const size_t* page_sizes, int count);
static void trace_page_sizes(const char* str,
const size_t region_min_size,
const size_t region_max_size,
const size_t page_size,
const char* base,
const size_t size);
const size_t size,
const size_t page_size);
static void trace_page_sizes_for_requested_size(const char* str,
const size_t requested_size,
const size_t page_size,
const size_t alignment,
const size_t requested_page_size,
const char* base,
const size_t size);
const size_t size,
const size_t page_size);

static size_t vm_allocation_granularity() { return OSInfo::vm_allocation_granularity(); }

Expand Down
5 changes: 3 additions & 2 deletions test/hotspot/jtreg/gc/g1/TestLargePageUseForAuxMemory.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ static void checkSize(OutputAnalyzer output, long expectedSize, String pattern)
}

static void checkSmallTables(OutputAnalyzer output, long expectedPageSize) throws Exception {
checkSize(output, expectedPageSize, "Block Offset Table: .*page_size=([^ ]+)");
checkSize(output, expectedPageSize, "Block Offset Table: .* page_size=(\\d+[BKMG])");
}

static void checkBitmap(OutputAnalyzer output, long expectedPageSize) throws Exception {
checkSize(output, expectedPageSize, "Mark Bitmap: .*page_size=([^ ]+)");
checkSize(output, expectedPageSize, "Mark Bitmap: .* page_size=(\\d+[BKMG])");
}

static List<String> getOpts(long heapsize, boolean largePageEnabled) {
Expand All @@ -126,6 +126,7 @@ static void testVM(String what, long heapsize, boolean cardsShouldUseLargePages,
pb = ProcessTools.createJavaProcessBuilder(getOpts(heapsize, true));

OutputAnalyzer output = new OutputAnalyzer(pb.start());

// Only expect large page size if large pages are enabled.
if (largePagesEnabled(output)) {
checkSmallTables(output, (cardsShouldUseLargePages ? largePageSize : smallPageSize));
Expand Down
2 changes: 1 addition & 1 deletion test/hotspot/jtreg/gc/g1/TestLargePageUseForHeap.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static boolean checkLargePageEnabled(OutputAnalyzer output) {
}

static void checkHeap(OutputAnalyzer output, long expectedPageSize) throws Exception {
checkSize(output, expectedPageSize, "Heap: .*page_size=([^ ]+)");
checkSize(output, expectedPageSize, "Heap: .* page_size=(\\d+[BKMG])");
}

static void testVM(long regionSize) throws Exception {
Expand Down
2 changes: 1 addition & 1 deletion test/hotspot/jtreg/gc/g1/numa/TestG1NUMATouchRegions.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static long parseSizeString(String size) {
}

static long heapPageSize(OutputAnalyzer output) {
String HeapPageSizePattern = "Heap: .*page_size=([^ ]+)";
String HeapPageSizePattern = "Heap: .* page_size=(\\d+[BKMG])";
String str = output.firstMatch(HeapPageSizePattern, 1);

if (str == null) {
Expand Down
2 changes: 1 addition & 1 deletion test/hotspot/jtreg/runtime/os/TestTracePageSizes.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public static void main(String args[]) throws Exception {
parseSmaps();

// Setup patters for the JVM page size logging.
String traceLinePatternString = ".*base=(0x[0-9A-Fa-f]*).*page_size=([^ ]+).*";
String traceLinePatternString = ".*base=(0x[0-9A-Fa-f]*).* page_size=(\\d+[BKMG]).*";
Pattern traceLinePattern = Pattern.compile(traceLinePatternString);

// The test needs to be run with page size logging printed to ps-$pid.log.
Expand Down

1 comment on commit 6473a7d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.