Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure that we only allocate 4k pages #7358

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions port/common/omrmem32helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ allocateVmemRegion32(struct OMRPortLibrary *portLibrary, uintptr_t byteAmount, J
*/
#if defined(OMR_PORT_CAN_RESERVE_SPECIFIC_ADDRESS)
J9PortVmemIdentifier *vmemID = NULL;
uintptr_t *pageSizes = NULL;
uintptr_t pageSize = 0;
uintptr_t i = 0;
J9HeapWrapper *wrapper = NULL;
Expand All @@ -556,8 +557,10 @@ allocateVmemRegion32(struct OMRPortLibrary *portLibrary, uintptr_t byteAmount, J
return NULL;
}

pageSizes = portLibrary->vmem_supported_page_sizes(portLibrary);

/* get the default page size */
pageSize = portLibrary->vmem_supported_page_sizes(portLibrary)[0];
pageSize = pageSizes[0];
if (0 == pageSize) {
Trc_PRT_mem_allocate_memory32_failed_page(callSite);
portLibrary->mem_free_memory(portLibrary, vmemID);
Expand All @@ -566,8 +569,18 @@ allocateVmemRegion32(struct OMRPortLibrary *portLibrary, uintptr_t byteAmount, J
}

/* use a minimum 4K page size */
if (pageSize < 0x1000) {
pageSize = 0x1000;
// if (pageSize < 0x1000) {
// pageSize = 0x1000;
// }
/* Make sure that we only allocate 4k pages. */
// pageSize = 0x1000;
/* If 4K is not the default page size, then look for the smallest one as per omrvmem_startup. */
if (0x1000 != pageSize) {
for (i = 0 ; pageSizes[i] != 0 ; i++) {
if (pageSize > pageSizes[i]) {
pageSize = pageSizes[i];
}
}
}

#if defined(LINUX)
Expand Down