Skip to content
Permalink
Browse files
8243961: ForceNUMA and only one available NUMA node fails assertion o…
…n Windows

Improve ergnomics for UseNUMA and UseNUMAInterleaving

Reviewed-by: tschatzl, sjohanss
  • Loading branch information
Kim Barrett committed May 6, 2020
1 parent 317bd88 commit 7ae3bea21285185c29abb83084930a8f30587c7a
@@ -3549,10 +3549,9 @@ jint os::init_2(void) {
return JNI_ERR;
}

if (UseNUMA) {
UseNUMA = false;
warning("NUMA optimizations are not available on this OS.");
}
// Not supported.
FLAG_SET_ERGO(UseNUMA, false);
FLAG_SET_ERGO(UseNUMAInterleaving, false);

if (MaxFDLimit) {
// Set the number of file descriptors to max. print out error
@@ -3140,6 +3140,10 @@ jint os::init_2(void) {
return JNI_ERR;
}

// Not supported.
FLAG_SET_ERGO(UseNUMA, false);
FLAG_SET_ERGO(UseNUMAInterleaving, false);

if (MaxFDLimit) {
// set the number of file descriptors to max. print out error
// if getrlimit/setrlimit fails but continue regardless.
@@ -5175,7 +5175,8 @@ void os::Linux::numa_init() {
// bitmask when externally configured to run on all or fewer nodes.

if (!Linux::libnuma_init()) {
UseNUMA = false;
FLAG_SET_ERGO(UseNUMA, false);
FLAG_SET_ERGO(UseNUMAInterleaving, false); // Also depends on libnuma.
} else {
if ((Linux::numa_max_node() < 1) || Linux::is_bound_to_single_node()) {
// If there's only one node (they start from 0) or if the process
@@ -5208,6 +5209,11 @@ void os::Linux::numa_init() {
}
}

// When NUMA requested, not-NUMA-aware allocations default to interleaving.
if (UseNUMA && !UseNUMAInterleaving) {
FLAG_SET_ERGO_IF_DEFAULT(UseNUMAInterleaving, true);
}

if (UseParallelGC && UseNUMA && UseLargePages && !can_commit_large_page_memory()) {
// With SHM and HugeTLBFS large pages we cannot uncommit a page, so there's no way
// we can make the adaptive lgrp chunk resizing work. If the user specified both
@@ -5272,7 +5278,7 @@ jint os::init_2(void) {
log_info(os)("HotSpot is running with %s, %s",
Linux::glibc_version(), Linux::libpthread_version());

if (UseNUMA) {
if (UseNUMA || UseNUMAInterleaving) {
Linux::numa_init();
}

@@ -3916,7 +3916,7 @@ jint os::init_2(void) {

if (UseNUMA) {
if (!Solaris::liblgrp_init()) {
UseNUMA = false;
FLAG_SET_ERGO(UseNUMA, false);
} else {
size_t lgrp_limit = os::numa_get_groups_num();
int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit, mtInternal);
@@ -3930,6 +3930,11 @@ jint os::init_2(void) {
}
}

// When NUMA requested, not-NUMA-aware allocations default to interleaving.
if (UseNUMA && !UseNUMAInterleaving) {
FLAG_SET_ERGO_IF_DEFAULT(UseNUMAInterleaving, true);
}

Solaris::signal_sets_init();
Solaris::init_signal_mem();
Solaris::install_signal_handlers();
@@ -4096,10 +4096,13 @@ jint os::init_2(void) {
UseNUMA = false; // We don't fully support this yet
}

if (UseNUMAInterleaving) {
// first check whether this Windows OS supports VirtualAllocExNuma, if not ignore this flag
bool success = numa_interleaving_init();
if (!success) UseNUMAInterleaving = false;
if (UseNUMAInterleaving || (UseNUMA && FLAG_IS_DEFAULT(UseNUMAInterleaving))) {
if (!numa_interleaving_init()) {
FLAG_SET_ERGO(UseNUMAInterleaving, false);
} else if (!UseNUMAInterleaving) {
// When NUMA requested, not-NUMA-aware allocations default to interleaving.
FLAG_SET_ERGO(UseNUMAInterleaving, true);
}
}

if (initSock() != JNI_OK) {
@@ -4158,14 +4158,6 @@ jint Arguments::adjust_after_os() {
FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
}
}
// UseNUMAInterleaving is set to ON for all collectors and platforms when
// UseNUMA is set to ON. NUMA-aware collectors will interleave old gen and
// survivor spaces on top of NUMA allocation policy for the eden space.
// Non NUMA-aware collectors will interleave all of the heap spaces across
// NUMA nodes.
if (FLAG_IS_DEFAULT(UseNUMAInterleaving)) {
FLAG_SET_ERGO(UseNUMAInterleaving, true);
}
}
return JNI_OK;
}

0 comments on commit 7ae3bea

Please sign in to comment.