提交 6c916f33 编写于 作者: I iveresov

7082969: NUMA interleaving

Summary: Support interleaving on NUMA systems for collectors that don't have NUMA-awareness.
Reviewed-by: iveresov, ysr
Contributed-by: NTom Deneau <tom.deneau@amd.com>
上级 574389b2
......@@ -2502,7 +2502,13 @@ bool os::commit_memory(char* addr, size_t size, bool exec) {
int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE;
uintptr_t res = (uintptr_t) ::mmap(addr, size, prot,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0);
return res != (uintptr_t) MAP_FAILED;
if (res != (uintptr_t) MAP_FAILED) {
if (UseNUMAInterleaving) {
numa_make_global(addr, size);
}
return true;
}
return false;
}
// Define MAP_HUGETLB here so we can build HotSpot on old systems.
......@@ -2523,7 +2529,13 @@ bool os::commit_memory(char* addr, size_t size, size_t alignment_hint,
(uintptr_t) ::mmap(addr, size, prot,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|MAP_HUGETLB,
-1, 0);
return res != (uintptr_t) MAP_FAILED;
if (res != (uintptr_t) MAP_FAILED) {
if (UseNUMAInterleaving) {
numa_make_global(addr, size);
}
return true;
}
return false;
}
return commit_memory(addr, size, exec);
......@@ -3115,6 +3127,10 @@ char* os::reserve_memory_special(size_t bytes, char* req_addr, bool exec) {
return NULL;
}
if ((addr != NULL) && UseNUMAInterleaving) {
numa_make_global(addr, bytes);
}
return addr;
}
......
......@@ -2777,8 +2777,14 @@ int os::vm_allocation_granularity() {
bool os::commit_memory(char* addr, size_t bytes, bool exec) {
int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE;
size_t size = bytes;
return
NULL != Solaris::mmap_chunk(addr, size, MAP_PRIVATE|MAP_FIXED, prot);
char *res = Solaris::mmap_chunk(addr, size, MAP_PRIVATE|MAP_FIXED, prot);
if (res != NULL) {
if (UseNUMAInterleaving) {
numa_make_global(addr, bytes);
}
return true;
}
return false;
}
bool os::commit_memory(char* addr, size_t bytes, size_t alignment_hint,
......@@ -3389,12 +3395,11 @@ bool os::Solaris::set_mpss_range(caddr_t start, size_t bytes, size_t align) {
return true;
}
char* os::reserve_memory_special(size_t bytes, char* addr, bool exec) {
char* os::reserve_memory_special(size_t size, char* addr, bool exec) {
// "exec" is passed in but not used. Creating the shared image for
// the code cache doesn't have an SHM_X executable permission to check.
assert(UseLargePages && UseISM, "only for ISM large pages");
size_t size = bytes;
char* retAddr = NULL;
int shmid;
key_t ismKey;
......@@ -3436,7 +3441,9 @@ char* os::reserve_memory_special(size_t bytes, char* addr, bool exec) {
}
return NULL;
}
if ((retAddr != NULL) && UseNUMAInterleaving) {
numa_make_global(retAddr, size);
}
return retAddr;
}
......
此差异已折叠。
......@@ -173,13 +173,25 @@ public:
static BOOL GetNativeSystemInfoAvailable();
static void GetNativeSystemInfo(LPSYSTEM_INFO);
// NUMA calls
static BOOL NumaCallsAvailable();
static LPVOID VirtualAllocExNuma(HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD);
static BOOL GetNumaHighestNodeNumber(PULONG);
static BOOL GetNumaNodeProcessorMask(UCHAR, PULONGLONG);
private:
// GetLargePageMinimum available on Windows Vista/Windows Server 2003
// and later
// NUMA calls available Windows Vista/WS2008 and later
static SIZE_T (WINAPI *_GetLargePageMinimum)(void);
static LPVOID (WINAPI *_VirtualAllocExNuma) (HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD);
static BOOL (WINAPI *_GetNumaHighestNodeNumber) (PULONG);
static BOOL (WINAPI *_GetNumaNodeProcessorMask) (UCHAR, PULONGLONG);
static BOOL initialized;
static void initialize();
static void initializeCommon();
#ifdef JDK6_OR_EARLIER
private:
......
......@@ -1423,6 +1423,9 @@ void Arguments::set_parallel_gc_flags() {
if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
}
// For those collectors or operating systems (eg, Windows) that do
// not support full UseNUMA, we will map to UseNUMAInterleaving for now
UseNUMAInterleaving = true;
}
}
......
......@@ -475,6 +475,12 @@ class CommandLineFlags {
product(bool, UseNUMA, false, \
"Use NUMA if available") \
\
product(bool, UseNUMAInterleaving, false, \
"Interleave memory across NUMA nodes if available") \
\
product(uintx, NUMAInterleaveGranularity, 2*M, \
"Granularity to use for NUMA interleaving on Windows OS") \
\
product(bool, ForceNUMA, false, \
"Force NUMA optimizations on single-node/UMA systems") \
\
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册