8077255: TracePageSizes output reports wrong page size on Windows with G1
Print selected page size, not alignment size chosen by ReservedSpace (which is the vm_allocation_granularity that is different to page size on Windows) in the message presented by TracePageSizes. Reviewed-by: drwhite, jmasa
This commit is contained in:
parent
d86a561fe4
commit
06bba0999a
@ -1805,8 +1805,9 @@ G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) :
|
||||
G1RegionToSpaceMapper* G1CollectedHeap::create_aux_memory_mapper(const char* description,
|
||||
size_t size,
|
||||
size_t translation_factor) {
|
||||
size_t preferred_page_size = os::page_size_for_region_unaligned(size, 1);
|
||||
// Allocate a new reserved space, preferring to use large pages.
|
||||
ReservedSpace rs(size, true);
|
||||
ReservedSpace rs(size, preferred_page_size);
|
||||
G1RegionToSpaceMapper* result =
|
||||
G1RegionToSpaceMapper::create_mapper(rs,
|
||||
size,
|
||||
@ -1816,7 +1817,7 @@ G1RegionToSpaceMapper* G1CollectedHeap::create_aux_memory_mapper(const char* des
|
||||
mtGC);
|
||||
if (TracePageSizes) {
|
||||
gclog_or_tty->print_cr("G1 '%s': pg_sz=" SIZE_FORMAT " base=" PTR_FORMAT " size=" SIZE_FORMAT " alignment=" SIZE_FORMAT " reqsize=" SIZE_FORMAT,
|
||||
description, rs.alignment(), p2i(rs.base()), rs.size(), rs.alignment(), size);
|
||||
description, preferred_page_size, p2i(rs.base()), rs.size(), rs.alignment(), size);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -37,12 +37,13 @@ ReservedSpace::ReservedSpace() : _base(NULL), _size(0), _noaccess_prefix(0),
|
||||
_alignment(0), _special(false), _executable(false) {
|
||||
}
|
||||
|
||||
ReservedSpace::ReservedSpace(size_t size, bool prefer_large_pages) {
|
||||
ReservedSpace::ReservedSpace(size_t size, size_t preferred_page_size) {
|
||||
bool has_preferred_page_size = preferred_page_size != 0;
|
||||
// Want to use large pages where possible and pad with small pages.
|
||||
size_t page_size = os::page_size_for_region_unaligned(size, 1);
|
||||
size_t page_size = has_preferred_page_size ? preferred_page_size : os::page_size_for_region_unaligned(size, 1);
|
||||
bool large_pages = page_size != (size_t)os::vm_page_size();
|
||||
size_t alignment;
|
||||
if (large_pages && prefer_large_pages) {
|
||||
if (large_pages && has_preferred_page_size) {
|
||||
alignment = MAX2(page_size, (size_t)os::vm_allocation_granularity());
|
||||
// ReservedSpace initialization requires size to be aligned to the given
|
||||
// alignment. Align the size up.
|
||||
|
@ -51,12 +51,11 @@ class ReservedSpace VALUE_OBJ_CLASS_SPEC {
|
||||
public:
|
||||
// Constructor
|
||||
ReservedSpace();
|
||||
// Initialize the reserved space with the given size. If prefer_large_pages is
|
||||
// set, if the given size warrants use of large pages, try to force them by
|
||||
// passing an alignment restriction further down. This may waste some space
|
||||
// if the given size is not aligned, as the reservation will be aligned up
|
||||
// to large page alignment.
|
||||
ReservedSpace(size_t size, bool prefer_large_pages = false);
|
||||
// Initialize the reserved space with the given size. If preferred_page_size
|
||||
// is set, use this as minimum page size/alignment. This may waste some space
|
||||
// if the given size is not aligned to that value, as the reservation will be
|
||||
// aligned up to the final alignment in this case.
|
||||
ReservedSpace(size_t size, size_t preferred_page_size = 0);
|
||||
ReservedSpace(size_t size, size_t alignment, bool large,
|
||||
char* requested_address = NULL);
|
||||
ReservedSpace(size_t size, size_t alignment, bool large, bool executable);
|
||||
|
Loading…
x
Reference in New Issue
Block a user