< prev index next >
src/hotspot/os/linux/os_linux.cpp
Print this page
*** 126,137 ****
#define MAX_SECS 100000000
// for timer info max values which include all bits
#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;
address os::Linux::_initial_thread_stack_bottom = NULL;
--- 126,141 ----
#define MAX_SECS 100000000
// for timer info max values which include all bits
#define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
! enum CoredumpFilterBit {
! FILE_BACKED_PVT_BIT = 1 << 2,
! LARGEPAGES_BIT = 1 << 6,
! DAX_SHARED_BIT = 1 << 8
! };
!
////////////////////////////////////////////////////////////////////////////////
// global variables
julong os::Linux::_physical_memory = 0;
address os::Linux::_initial_thread_stack_bottom = NULL;
*** 3397,3431 ****
// - (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(bool largepages, bool dax_shared) {
FILE *f;
long cdm;
- bool filter_changed = false;
if ((f = fopen("/proc/self/coredump_filter", "r+")) == NULL) {
return;
}
if (fscanf(f, "%lx", &cdm) != 1) {
fclose(f);
return;
}
rewind(f);
! 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);
}
fclose(f);
}
--- 3401,3428 ----
// - (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(CoredumpFilterBit bit) {
FILE *f;
long cdm;
if ((f = fopen("/proc/self/coredump_filter", "r+")) == NULL) {
return;
}
if (fscanf(f, "%lx", &cdm) != 1) {
fclose(f);
return;
}
+ long saved_cdm = cdm;
rewind(f);
+ cdm |= bit;
! if (cdm != saved_cdm) {
fprintf(f, "%#lx", cdm);
}
fclose(f);
}
*** 3560,3570 ****
}
size_t large_page_size = Linux::setup_large_page_size();
UseLargePages = Linux::setup_large_page_type(large_page_size);
! set_coredump_filter(true /*largepages*/, false /*dax_shared*/);
}
#ifndef SHM_HUGETLB
#define SHM_HUGETLB 04000
#endif
--- 3557,3567 ----
}
size_t large_page_size = Linux::setup_large_page_size();
UseLargePages = Linux::setup_large_page_type(large_page_size);
! set_coredump_filter(LARGEPAGES_BIT);
}
#ifndef SHM_HUGETLB
#define SHM_HUGETLB 04000
#endif
*** 5064,5075 ****
// initialize thread priority policy
prio_init();
if (!FLAG_IS_DEFAULT(AllocateHeapAt)) {
! set_coredump_filter(false /*largepages*/, true /*dax_shared*/);
}
return JNI_OK;
}
// Mark the polling page as unreadable
void os::make_polling_page_unreadable(void) {
--- 5061,5077 ----
// initialize thread priority policy
prio_init();
if (!FLAG_IS_DEFAULT(AllocateHeapAt)) {
! set_coredump_filter(DAX_SHARED_BIT);
}
+
+ if (UseSharedSpaces) {
+ set_coredump_filter(FILE_BACKED_PVT_BIT);
+ }
+
return JNI_OK;
}
// Mark the polling page as unreadable
void os::make_polling_page_unreadable(void) {
< prev index next >