< prev index next >
src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp
Print this page
rev 7618 : 8062063: Usage of UseHugeTLBFS, UseLargePagesInMetaspace and huge SurvivorAlignmentInBytes cause crashes in CMBitMapClosure::do_bit
Summary: Making sure committed memory is cleared when re-committed, even if using large pages.
Reviewed-by:
rev 7619 : [mq]: clear-in-listener
rev 7620 : [mq]: needs-zeroing-to-dirty
*** 44,54 ****
#endif
#include "utilities/bitMap.inline.hpp"
G1PageBasedVirtualSpace::G1PageBasedVirtualSpace() : _low_boundary(NULL),
_high_boundary(NULL), _committed(), _page_size(0), _special(false),
! _needs_zeroing(), _executable(false) {
}
bool G1PageBasedVirtualSpace::initialize_with_granularity(ReservedSpace rs, size_t page_size) {
if (!rs.is_reserved()) {
return false; // Allocation failed.
--- 44,54 ----
#endif
#include "utilities/bitMap.inline.hpp"
G1PageBasedVirtualSpace::G1PageBasedVirtualSpace() : _low_boundary(NULL),
_high_boundary(NULL), _committed(), _page_size(0), _special(false),
! _dirty(), _executable(false) {
}
bool G1PageBasedVirtualSpace::initialize_with_granularity(ReservedSpace rs, size_t page_size) {
if (!rs.is_reserved()) {
return false; // Allocation failed.
*** 66,76 ****
assert(_committed.size() == 0, "virtual space initialized more than once");
uintx size_in_bits = rs.size() / page_size;
_committed.resize(size_in_bits, /* in_resource_area */ false);
if (_special) {
! _needs_zeroing.resize(size_in_bits, /* in_resource_area */ false);
}
return true;
}
--- 66,76 ----
assert(_committed.size() == 0, "virtual space initialized more than once");
uintx size_in_bits = rs.size() / page_size;
_committed.resize(size_in_bits, /* in_resource_area */ false);
if (_special) {
! _dirty.resize(size_in_bits, /* in_resource_area */ false);
}
return true;
}
*** 86,96 ****
_high_boundary = NULL;
_special = false;
_executable = false;
_page_size = 0;
_committed.resize(0, false);
! _needs_zeroing.resize(0, false);
}
size_t G1PageBasedVirtualSpace::committed_size() const {
return _committed.count_one_bits() * _page_size;
}
--- 86,96 ----
_high_boundary = NULL;
_special = false;
_executable = false;
_page_size = 0;
_committed.resize(0, false);
! _dirty.resize(0, false);
}
size_t G1PageBasedVirtualSpace::committed_size() const {
return _committed.count_one_bits() * _page_size;
}
*** 131,146 ****
bool zero_filled = true;
uintptr_t end = start + size_in_pages;
if (_special) {
! // When the memory is _special it is not really uncommitted. _needs_zeroing is
! // used to keep track if the current committed range contains pages that are all
! // zeroed or not.
! if (_needs_zeroing.get_next_one_offset(start,end) < end) {
zero_filled = false;
! _needs_zeroing.clear_range(start, end);
}
} else {
os::commit_memory_or_exit(page_start(start), byte_size_for_pages(size_in_pages), _executable,
err_msg("Failed to commit pages from "SIZE_FORMAT" of length "SIZE_FORMAT, start, size_in_pages));
}
--- 131,144 ----
bool zero_filled = true;
uintptr_t end = start + size_in_pages;
if (_special) {
! // Check for dirty pages and update zero_filled if any found.
! if (_dirty.get_next_one_offset(start,end) < end) {
zero_filled = false;
! _dirty.clear_range(start, end);
}
} else {
os::commit_memory_or_exit(page_start(start), byte_size_for_pages(size_in_pages), _executable,
err_msg("Failed to commit pages from "SIZE_FORMAT" of length "SIZE_FORMAT, start, size_in_pages));
}
*** 154,165 ****
void G1PageBasedVirtualSpace::uncommit(uintptr_t start, size_t size_in_pages) {
guarantee(is_area_committed(start, size_in_pages), "checking");
if (_special) {
! // Mark that memory needs to be cleared if committed again.
! _needs_zeroing.set_range(start, start + size_in_pages);
} else {
os::uncommit_memory(page_start(start), byte_size_for_pages(size_in_pages));
}
_committed.clear_range(start, start + size_in_pages);
--- 152,164 ----
void G1PageBasedVirtualSpace::uncommit(uintptr_t start, size_t size_in_pages) {
guarantee(is_area_committed(start, size_in_pages), "checking");
if (_special) {
! // Mark that memory is dirty. If committed again the memory might
! // need to be cleared explicitly.
! _dirty.set_range(start, start + size_in_pages);
} else {
os::uncommit_memory(page_start(start), byte_size_for_pages(size_in_pages));
}
_committed.clear_range(start, start + size_in_pages);
< prev index next >