8312585: Rename DisableTHPStackMitigation flag to THPStackMitigation
Reviewed-by: dholmes, stuefe
This commit is contained in:
parent
dc01604756
commit
226cdc696d
@ -89,10 +89,10 @@
|
|||||||
"to disable both the override and the printouts." \
|
"to disable both the override and the printouts." \
|
||||||
"See prctl(PR_SET_TIMERSLACK) for more info.") \
|
"See prctl(PR_SET_TIMERSLACK) for more info.") \
|
||||||
\
|
\
|
||||||
product(bool, DisableTHPStackMitigation, false, DIAGNOSTIC, \
|
product(bool, THPStackMitigation, true, DIAGNOSTIC, \
|
||||||
"If THPs are unconditionally enabled on the system (mode " \
|
"If THPs are unconditionally enabled on the system (mode " \
|
||||||
"\"always\"), the JVM will prevent THP from forming in " \
|
"\"always\"), the JVM will prevent THP from forming in " \
|
||||||
"thread stacks. This switch disables that mitigation and " \
|
"thread stacks. When disabled, the absence of this mitigation"\
|
||||||
"allows THPs to form in thread stacks.") \
|
"allows THPs to form in thread stacks.") \
|
||||||
\
|
\
|
||||||
develop(bool, DelayThreadStartALot, false, \
|
develop(bool, DelayThreadStartALot, false, \
|
||||||
|
@ -936,7 +936,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
|
|||||||
}
|
}
|
||||||
assert(is_aligned(stack_size, os::vm_page_size()), "stack_size not aligned");
|
assert(is_aligned(stack_size, os::vm_page_size()), "stack_size not aligned");
|
||||||
|
|
||||||
if (!DisableTHPStackMitigation) {
|
if (THPStackMitigation) {
|
||||||
// In addition to the glibc guard page that prevents inter-thread-stack hugepage
|
// In addition to the glibc guard page that prevents inter-thread-stack hugepage
|
||||||
// coalescing (see comment in os::Linux::default_guard_size()), we also make
|
// coalescing (see comment in os::Linux::default_guard_size()), we also make
|
||||||
// sure the stack size itself is not huge-page-size aligned; that makes it much
|
// sure the stack size itself is not huge-page-size aligned; that makes it much
|
||||||
@ -3102,7 +3102,7 @@ bool os::Linux::libnuma_init() {
|
|||||||
|
|
||||||
size_t os::Linux::default_guard_size(os::ThreadType thr_type) {
|
size_t os::Linux::default_guard_size(os::ThreadType thr_type) {
|
||||||
|
|
||||||
if (!DisableTHPStackMitigation) {
|
if (THPStackMitigation) {
|
||||||
// If THPs are unconditionally enabled, the following scenario can lead to huge RSS
|
// If THPs are unconditionally enabled, the following scenario can lead to huge RSS
|
||||||
// - parent thread spawns, in quick succession, multiple child threads
|
// - parent thread spawns, in quick succession, multiple child threads
|
||||||
// - child threads are slow to start
|
// - child threads are slow to start
|
||||||
@ -3764,15 +3764,15 @@ void os::large_page_init() {
|
|||||||
// coalesce small pages in thread stacks to huge pages. That costs a lot of memory and
|
// coalesce small pages in thread stacks to huge pages. That costs a lot of memory and
|
||||||
// is usually unwanted for thread stacks. Therefore we attempt to prevent THP formation in
|
// is usually unwanted for thread stacks. Therefore we attempt to prevent THP formation in
|
||||||
// thread stacks unless the user explicitly allowed THP formation by manually disabling
|
// thread stacks unless the user explicitly allowed THP formation by manually disabling
|
||||||
// -XX:+DisableTHPStackMitigation.
|
// -XX:-THPStackMitigation.
|
||||||
if (HugePages::thp_mode() == THPMode::always) {
|
if (HugePages::thp_mode() == THPMode::always) {
|
||||||
if (DisableTHPStackMitigation) {
|
if (THPStackMitigation) {
|
||||||
log_info(pagesize)("JVM will *not* prevent THPs in thread stacks. This may cause high RSS.");
|
|
||||||
} else {
|
|
||||||
log_info(pagesize)("JVM will attempt to prevent THPs in thread stacks.");
|
log_info(pagesize)("JVM will attempt to prevent THPs in thread stacks.");
|
||||||
|
} else {
|
||||||
|
log_info(pagesize)("JVM will *not* prevent THPs in thread stacks. This may cause high RSS.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FLAG_SET_ERGO(DisableTHPStackMitigation, true); // Mitigation not needed
|
FLAG_SET_ERGO(THPStackMitigation, false); // Mitigation not needed
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1) Handle the case where we do not want to use huge pages
|
// 1) Handle the case where we do not want to use huge pages
|
||||||
|
@ -208,7 +208,7 @@ public class THPsInThreadStackPreventionTest {
|
|||||||
|
|
||||||
// explicitly disable the no-THP-workaround:
|
// explicitly disable the no-THP-workaround:
|
||||||
finalargs.add("-XX:+UnlockDiagnosticVMOptions");
|
finalargs.add("-XX:+UnlockDiagnosticVMOptions");
|
||||||
finalargs.add("-XX:+DisableTHPStackMitigation");
|
finalargs.add("-XX:-THPStackMitigation");
|
||||||
|
|
||||||
finalargs.add(TestMain.class.getName());
|
finalargs.add(TestMain.class.getName());
|
||||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(finalargs);
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(finalargs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user