The following code block is duplicated in ReservedSpace::initialize/ReservedSpace::try_reserve_heap (sans minor spacing):
// If OS doesn't support demand paging for large page memory, we need
// to use reserve_memory_special() to reserve and pin the entire region.
// If there is a backing file directory for this space then whether
// large pages are allocated is up to the filesystem of the backing file.
// So we ignore the UseLargePages flag in this case.
bool special = large && !os::can_commit_large_page_memory();
if (special && _fd_for_heap != -1) {
special = false;
if (UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) ||
!FLAG_IS_DEFAULT(LargePageSizeInBytes))) {
log_debug(gc, heap)("Cannot allocate large pages for Java Heap when AllocateHeapAt option is set.");
}
}
Actually some more code below that block seems to be awfully similar too.
Factor out this code to clean it up.
// If OS doesn't support demand paging for large page memory, we need
// to use reserve_memory_special() to reserve and pin the entire region.
// If there is a backing file directory for this space then whether
// large pages are allocated is up to the filesystem of the backing file.
// So we ignore the UseLargePages flag in this case.
bool special = large && !os::can_commit_large_page_memory();
if (special && _fd_for_heap != -1) {
special = false;
if (UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) ||
!FLAG_IS_DEFAULT(LargePageSizeInBytes))) {
log_debug(gc, heap)("Cannot allocate large pages for Java Heap when AllocateHeapAt option is set.");
}
}
Actually some more code below that block seems to be awfully similar too.
Factor out this code to clean it up.