提交 134dd2b1 编写于 作者: T tschatzl

8077255: TracePageSizes output reports wrong page size on Windows with G1

Summary: 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
上级 89430373
......@@ -1907,8 +1907,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,
......@@ -1918,7 +1919,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;
}
......
......@@ -52,12 +52,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.
......
......@@ -54,12 +54,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,
const size_t noaccess_prefix = 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册