8283935: Parallel: Crash during pretouch after large pages allocation failure

Reviewed-by: kbarrett, ayang
This commit is contained in:
Thomas Schatzl 2022-04-06 08:01:47 +00:00
parent 0a67d68670
commit b56df2808d
3 changed files with 7 additions and 8 deletions

View File

@ -589,7 +589,7 @@ void MutableNUMASpace::initialize(MemRegion mr,
// Compute chunk sizes
size_t prev_page_size = page_size();
set_page_size(UseLargePages ? alignment() : os::vm_page_size());
set_page_size(alignment());
HeapWord* rounded_bottom = align_up(bottom(), page_size());
HeapWord* rounded_end = align_down(end(), page_size());
size_t base_space_size_pages = pointer_delta(rounded_end, rounded_bottom, sizeof(char)) / page_size();

View File

@ -52,9 +52,8 @@ MutableSpace::~MutableSpace() {
delete _mangler;
}
void MutableSpace::numa_setup_pages(MemRegion mr, bool clear_space) {
void MutableSpace::numa_setup_pages(MemRegion mr, size_t page_size, bool clear_space) {
if (!mr.is_empty()) {
size_t page_size = UseLargePages ? alignment() : os::vm_page_size();
HeapWord *start = align_up(mr.start(), page_size);
HeapWord *end = align_down(mr.end(), page_size);
if (end > start) {
@ -113,14 +112,14 @@ void MutableSpace::initialize(MemRegion mr,
}
assert(mr.contains(head) && mr.contains(tail), "Sanity");
size_t page_size = alignment();
if (UseNUMA) {
numa_setup_pages(head, clear_space);
numa_setup_pages(tail, clear_space);
numa_setup_pages(head, page_size, clear_space);
numa_setup_pages(tail, page_size, clear_space);
}
if (AlwaysPreTouch) {
size_t page_size = UseLargePages ? os::large_page_size() : os::vm_page_size();
PretouchTask::pretouch("ParallelGC PreTouch head", (char*)head.start(), (char*)head.end(),
page_size, pretouch_workers);

View File

@ -62,7 +62,7 @@ class MutableSpace: public CHeapObj<mtGC> {
MutableSpaceMangler* mangler() { return _mangler; }
void numa_setup_pages(MemRegion mr, bool clear_space);
void numa_setup_pages(MemRegion mr, size_t page_size, bool clear_space);
void set_last_setup_region(MemRegion mr) { _last_setup_region = mr; }
MemRegion last_setup_region() const { return _last_setup_region; }