8255047: Add HotSpot UseDebuggerErgo flags
Reviewed-by: dcubed, dholmes
This commit is contained in:
parent
211bb62a90
commit
ae72b5283b
@ -79,7 +79,7 @@
|
||||
"be dumped into the corefile.") \
|
||||
\
|
||||
product(bool, UseCpuAllocPath, false, DIAGNOSTIC, \
|
||||
"Use CPU_ALLOC code path in os::active_processor_count ")
|
||||
"Use CPU_ALLOC code path in os::active_processor_count ")
|
||||
|
||||
// end of RUNTIME_OS_FLAGS
|
||||
|
||||
|
@ -3217,7 +3217,17 @@ void os::Linux::rebuild_cpu_to_node_map() {
|
||||
if (cpu_map[j] != 0) {
|
||||
for (size_t k = 0; k < BitsPerCLong; k++) {
|
||||
if (cpu_map[j] & (1UL << k)) {
|
||||
cpu_to_node()->at_put(j * BitsPerCLong + k, closest_node);
|
||||
int cpu_index = j * BitsPerCLong + k;
|
||||
|
||||
#ifndef PRODUCT
|
||||
if (UseDebuggerErgo1 && cpu_index >= (int)cpu_num) {
|
||||
// Some debuggers limit the processor count without
|
||||
// intercepting the NUMA APIs. Just fake the values.
|
||||
cpu_index = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
cpu_to_node()->at_put(cpu_index, closest_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4762,7 +4772,16 @@ int os::active_processor_count() {
|
||||
|
||||
uint os::processor_id() {
|
||||
const int id = Linux::sched_getcpu();
|
||||
assert(id >= 0 && id < _processor_count, "Invalid processor id");
|
||||
|
||||
#ifndef PRODUCT
|
||||
if (UseDebuggerErgo1 && id >= _processor_count) {
|
||||
// Some debuggers limit the processor count without limiting
|
||||
// the returned processor ids. Fake the processor id.
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
assert(id >= 0 && id < _processor_count, "Invalid processor id [%d]", id);
|
||||
return (uint)id;
|
||||
}
|
||||
|
||||
|
@ -3901,6 +3901,22 @@ bool Arguments::handle_deprecated_print_gc_flags() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void apply_debugger_ergo() {
|
||||
if (UseDebuggerErgo) {
|
||||
// Turn on sub-flags
|
||||
FLAG_SET_ERGO_IF_DEFAULT(UseDebuggerErgo1, true);
|
||||
FLAG_SET_ERGO_IF_DEFAULT(UseDebuggerErgo2, true);
|
||||
}
|
||||
|
||||
if (UseDebuggerErgo2) {
|
||||
// Debugging with limited number of CPUs
|
||||
FLAG_SET_ERGO_IF_DEFAULT(UseNUMA, false);
|
||||
FLAG_SET_ERGO_IF_DEFAULT(ConcGCThreads, 1);
|
||||
FLAG_SET_ERGO_IF_DEFAULT(ParallelGCThreads, 1);
|
||||
FLAG_SET_ERGO_IF_DEFAULT(CICompilerCount, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Parse entry point called from JNI_CreateJavaVM
|
||||
|
||||
jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
||||
@ -4097,6 +4113,8 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
||||
}
|
||||
#endif
|
||||
|
||||
apply_debugger_ergo();
|
||||
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
|
@ -2207,6 +2207,17 @@ const intx ObjectAlignmentInBytes = 8;
|
||||
product(bool, UseNewCode3, false, DIAGNOSTIC, \
|
||||
"Testing Only: Use the new version while testing") \
|
||||
\
|
||||
notproduct(bool, UseDebuggerErgo, false, \
|
||||
"Debugging Only: Adjust the VM to be more debugger-friendly. " \
|
||||
"Turns on the other UseDebuggerErgo* flags") \
|
||||
\
|
||||
notproduct(bool, UseDebuggerErgo1, false, \
|
||||
"Debugging Only: Enable workarounds for debugger induced " \
|
||||
"os::processor_id() >= os::processor_count() problems") \
|
||||
\
|
||||
notproduct(bool, UseDebuggerErgo2, false, \
|
||||
"Debugging Only: Limit the number of spawned JVM threads") \
|
||||
\
|
||||
/* flags for performance data collection */ \
|
||||
\
|
||||
product(bool, UsePerfData, true, \
|
||||
|
Loading…
Reference in New Issue
Block a user