mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 18:14:38 +02:00
8190308: Implementation: JEP 316: Heap Allocation on Alternative Memory Devices
Sub-task to be used for implementation of JEP 316: Support heap allocation on alternative memory devices Reviewed-by: sangheki, tschatzl
This commit is contained in:
parent
3faa620f4c
commit
3fc999a1fe
14 changed files with 503 additions and 54 deletions
|
@ -130,6 +130,7 @@
|
|||
#define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
|
||||
|
||||
#define LARGEPAGES_BIT (1 << 6)
|
||||
#define DAX_SHARED_BIT (1 << 8)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// global variables
|
||||
julong os::Linux::_physical_memory = 0;
|
||||
|
@ -3370,10 +3371,13 @@ bool os::Linux::hugetlbfs_sanity_check(bool warn, size_t page_size) {
|
|||
// effective only if the bit 2 is cleared)
|
||||
// - (bit 5) hugetlb private memory
|
||||
// - (bit 6) hugetlb shared memory
|
||||
// - (bit 7) dax private memory
|
||||
// - (bit 8) dax shared memory
|
||||
//
|
||||
static void set_coredump_filter(void) {
|
||||
static void set_coredump_filter(bool largepages, bool dax_shared) {
|
||||
FILE *f;
|
||||
long cdm;
|
||||
bool filter_changed = false;
|
||||
|
||||
if ((f = fopen("/proc/self/coredump_filter", "r+")) == NULL) {
|
||||
return;
|
||||
|
@ -3386,8 +3390,15 @@ static void set_coredump_filter(void) {
|
|||
|
||||
rewind(f);
|
||||
|
||||
if ((cdm & LARGEPAGES_BIT) == 0) {
|
||||
if (largepages && (cdm & LARGEPAGES_BIT) == 0) {
|
||||
cdm |= LARGEPAGES_BIT;
|
||||
filter_changed = true;
|
||||
}
|
||||
if (dax_shared && (cdm & DAX_SHARED_BIT) == 0) {
|
||||
cdm |= DAX_SHARED_BIT;
|
||||
filter_changed = true;
|
||||
}
|
||||
if (filter_changed) {
|
||||
fprintf(f, "%#lx", cdm);
|
||||
}
|
||||
|
||||
|
@ -3526,7 +3537,7 @@ void os::large_page_init() {
|
|||
size_t large_page_size = Linux::setup_large_page_size();
|
||||
UseLargePages = Linux::setup_large_page_type(large_page_size);
|
||||
|
||||
set_coredump_filter();
|
||||
set_coredump_filter(true /*largepages*/, false /*dax_shared*/);
|
||||
}
|
||||
|
||||
#ifndef SHM_HUGETLB
|
||||
|
@ -3897,6 +3908,17 @@ bool os::can_execute_large_page_memory() {
|
|||
return UseTransparentHugePages || UseHugeTLBFS;
|
||||
}
|
||||
|
||||
char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr, int file_desc) {
|
||||
assert(file_desc >= 0, "file_desc is not valid");
|
||||
char* result = pd_attempt_reserve_memory_at(bytes, requested_addr);
|
||||
if (result != NULL) {
|
||||
if (replace_existing_mapping_with_file_mapping(result, bytes, file_desc) == NULL) {
|
||||
vm_exit_during_initialization(err_msg("Error in mapping Java heap at the given filesystem directory"));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Reserve memory at an arbitrary address, only if that area is
|
||||
// available (and not reserved for something else).
|
||||
|
||||
|
@ -5008,6 +5030,9 @@ jint os::init_2(void) {
|
|||
// initialize thread priority policy
|
||||
prio_init();
|
||||
|
||||
if (!FLAG_IS_DEFAULT(AllocateHeapAt)) {
|
||||
set_coredump_filter(false /*largepages*/, true /*dax_shared*/);
|
||||
}
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue