提交 4ca31d19 编写于 作者: J jmasa

6928081: G1: rename parameters common with CMS

Summary: Rename marking stack sizing flags to be common between G1 and CMS
Reviewed-by: ysr, tonyp
上级 176f8b2e
...@@ -46,9 +46,9 @@ CMSAdaptiveSizePolicy::CMSAdaptiveSizePolicy(size_t init_eden_size, ...@@ -46,9 +46,9 @@ CMSAdaptiveSizePolicy::CMSAdaptiveSizePolicy(size_t init_eden_size,
_processor_count = os::active_processor_count(); _processor_count = os::active_processor_count();
if (CMSConcurrentMTEnabled && (ParallelCMSThreads > 1)) { if (CMSConcurrentMTEnabled && (ConcGCThreads > 1)) {
assert(_processor_count > 0, "Processor count is suspect"); assert(_processor_count > 0, "Processor count is suspect");
_concurrent_processor_count = MIN2((uint) ParallelCMSThreads, _concurrent_processor_count = MIN2((uint) ConcGCThreads,
(uint) _processor_count); (uint) _processor_count);
} else { } else {
_concurrent_processor_count = 1; _concurrent_processor_count = 1;
......
...@@ -606,7 +606,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, ...@@ -606,7 +606,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
assert(_modUnionTable.covers(_span), "_modUnionTable inconsistency?"); assert(_modUnionTable.covers(_span), "_modUnionTable inconsistency?");
} }
if (!_markStack.allocate(CMSMarkStackSize)) { if (!_markStack.allocate(MarkStackSize)) {
warning("Failed to allocate CMS Marking Stack"); warning("Failed to allocate CMS Marking Stack");
return; return;
} }
...@@ -617,13 +617,13 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, ...@@ -617,13 +617,13 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
// Support for multi-threaded concurrent phases // Support for multi-threaded concurrent phases
if (ParallelGCThreads > 0 && CMSConcurrentMTEnabled) { if (ParallelGCThreads > 0 && CMSConcurrentMTEnabled) {
if (FLAG_IS_DEFAULT(ParallelCMSThreads)) { if (FLAG_IS_DEFAULT(ConcGCThreads)) {
// just for now // just for now
FLAG_SET_DEFAULT(ParallelCMSThreads, (ParallelGCThreads + 3)/4); FLAG_SET_DEFAULT(ConcGCThreads, (ParallelGCThreads + 3)/4);
} }
if (ParallelCMSThreads > 1) { if (ConcGCThreads > 1) {
_conc_workers = new YieldingFlexibleWorkGang("Parallel CMS Threads", _conc_workers = new YieldingFlexibleWorkGang("Parallel CMS Threads",
ParallelCMSThreads, true); ConcGCThreads, true);
if (_conc_workers == NULL) { if (_conc_workers == NULL) {
warning("GC/CMS: _conc_workers allocation failure: " warning("GC/CMS: _conc_workers allocation failure: "
"forcing -CMSConcurrentMTEnabled"); "forcing -CMSConcurrentMTEnabled");
...@@ -634,13 +634,13 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, ...@@ -634,13 +634,13 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
} }
} }
if (!CMSConcurrentMTEnabled) { if (!CMSConcurrentMTEnabled) {
ParallelCMSThreads = 0; ConcGCThreads = 0;
} else { } else {
// Turn off CMSCleanOnEnter optimization temporarily for // Turn off CMSCleanOnEnter optimization temporarily for
// the MT case where it's not fixed yet; see 6178663. // the MT case where it's not fixed yet; see 6178663.
CMSCleanOnEnter = false; CMSCleanOnEnter = false;
} }
assert((_conc_workers != NULL) == (ParallelCMSThreads > 1), assert((_conc_workers != NULL) == (ConcGCThreads > 1),
"Inconsistency"); "Inconsistency");
// Parallel task queues; these are shared for the // Parallel task queues; these are shared for the
...@@ -648,7 +648,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, ...@@ -648,7 +648,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
// are not shared with parallel scavenge (ParNew). // are not shared with parallel scavenge (ParNew).
{ {
uint i; uint i;
uint num_queues = (uint) MAX2(ParallelGCThreads, ParallelCMSThreads); uint num_queues = (uint) MAX2(ParallelGCThreads, ConcGCThreads);
if ((CMSParallelRemarkEnabled || CMSConcurrentMTEnabled if ((CMSParallelRemarkEnabled || CMSConcurrentMTEnabled
|| ParallelRefProcEnabled) || ParallelRefProcEnabled)
...@@ -3657,7 +3657,7 @@ bool CMSCollector::markFromRootsWork(bool asynch) { ...@@ -3657,7 +3657,7 @@ bool CMSCollector::markFromRootsWork(bool asynch) {
assert(_revisitStack.isEmpty(), "tabula rasa"); assert(_revisitStack.isEmpty(), "tabula rasa");
DEBUG_ONLY(RememberKlassesChecker cmx(should_unload_classes());) DEBUG_ONLY(RememberKlassesChecker cmx(should_unload_classes());)
bool result = false; bool result = false;
if (CMSConcurrentMTEnabled && ParallelCMSThreads > 0) { if (CMSConcurrentMTEnabled && ConcGCThreads > 0) {
result = do_marking_mt(asynch); result = do_marking_mt(asynch);
} else { } else {
result = do_marking_st(asynch); result = do_marking_st(asynch);
...@@ -4174,10 +4174,10 @@ void CMSConcMarkingTask::coordinator_yield() { ...@@ -4174,10 +4174,10 @@ void CMSConcMarkingTask::coordinator_yield() {
} }
bool CMSCollector::do_marking_mt(bool asynch) { bool CMSCollector::do_marking_mt(bool asynch) {
assert(ParallelCMSThreads > 0 && conc_workers() != NULL, "precondition"); assert(ConcGCThreads > 0 && conc_workers() != NULL, "precondition");
// In the future this would be determined ergonomically, based // In the future this would be determined ergonomically, based
// on #cpu's, # active mutator threads (and load), and mutation rate. // on #cpu's, # active mutator threads (and load), and mutation rate.
int num_workers = ParallelCMSThreads; int num_workers = ConcGCThreads;
CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace(); CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace();
CompactibleFreeListSpace* perm_space = _permGen->cmsSpace(); CompactibleFreeListSpace* perm_space = _permGen->cmsSpace();
...@@ -6429,8 +6429,8 @@ bool CMSMarkStack::allocate(size_t size) { ...@@ -6429,8 +6429,8 @@ bool CMSMarkStack::allocate(size_t size) {
// For now we take the expedient path of just disabling the // For now we take the expedient path of just disabling the
// messages for the problematic case.) // messages for the problematic case.)
void CMSMarkStack::expand() { void CMSMarkStack::expand() {
assert(_capacity <= CMSMarkStackSizeMax, "stack bigger than permitted"); assert(_capacity <= MarkStackSizeMax, "stack bigger than permitted");
if (_capacity == CMSMarkStackSizeMax) { if (_capacity == MarkStackSizeMax) {
if (_hit_limit++ == 0 && !CMSConcurrentMTEnabled && PrintGCDetails) { if (_hit_limit++ == 0 && !CMSConcurrentMTEnabled && PrintGCDetails) {
// We print a warning message only once per CMS cycle. // We print a warning message only once per CMS cycle.
gclog_or_tty->print_cr(" (benign) Hit CMSMarkStack max size limit"); gclog_or_tty->print_cr(" (benign) Hit CMSMarkStack max size limit");
...@@ -6438,7 +6438,7 @@ void CMSMarkStack::expand() { ...@@ -6438,7 +6438,7 @@ void CMSMarkStack::expand() {
return; return;
} }
// Double capacity if possible // Double capacity if possible
size_t new_capacity = MIN2(_capacity*2, CMSMarkStackSizeMax); size_t new_capacity = MIN2(_capacity*2, MarkStackSizeMax);
// Do not give up existing stack until we have managed to // Do not give up existing stack until we have managed to
// get the double capacity that we desired. // get the double capacity that we desired.
ReservedSpace rs(ReservedSpace::allocation_align_size_up( ReservedSpace rs(ReservedSpace::allocation_align_size_up(
......
...@@ -447,7 +447,7 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs, ...@@ -447,7 +447,7 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs,
gclog_or_tty->print_cr("[global] init, heap start = "PTR_FORMAT", " gclog_or_tty->print_cr("[global] init, heap start = "PTR_FORMAT", "
"heap end = "PTR_FORMAT, _heap_start, _heap_end); "heap end = "PTR_FORMAT, _heap_start, _heap_end);
_markStack.allocate(G1MarkStackSize); _markStack.allocate(MarkStackSize);
_regionStack.allocate(G1MarkRegionStackSize); _regionStack.allocate(G1MarkRegionStackSize);
// Create & start a ConcurrentMark thread. // Create & start a ConcurrentMark thread.
...@@ -483,8 +483,8 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs, ...@@ -483,8 +483,8 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs,
_accum_task_vtime[i] = 0.0; _accum_task_vtime[i] = 0.0;
} }
if (ParallelMarkingThreads > ParallelGCThreads) { if (ConcGCThreads > ParallelGCThreads) {
vm_exit_during_initialization("Can't have more ParallelMarkingThreads " vm_exit_during_initialization("Can't have more ConcGCThreads "
"than ParallelGCThreads."); "than ParallelGCThreads.");
} }
if (ParallelGCThreads == 0) { if (ParallelGCThreads == 0) {
...@@ -494,11 +494,11 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs, ...@@ -494,11 +494,11 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs,
_sleep_factor = 0.0; _sleep_factor = 0.0;
_marking_task_overhead = 1.0; _marking_task_overhead = 1.0;
} else { } else {
if (ParallelMarkingThreads > 0) { if (ConcGCThreads > 0) {
// notice that ParallelMarkingThreads overwrites G1MarkingOverheadPercent // notice that ConcGCThreads overwrites G1MarkingOverheadPercent
// if both are set // if both are set
_parallel_marking_threads = ParallelMarkingThreads; _parallel_marking_threads = ConcGCThreads;
_sleep_factor = 0.0; _sleep_factor = 0.0;
_marking_task_overhead = 1.0; _marking_task_overhead = 1.0;
} else if (G1MarkingOverheadPercent > 0) { } else if (G1MarkingOverheadPercent > 0) {
......
...@@ -88,9 +88,6 @@ ...@@ -88,9 +88,6 @@
diagnostic(bool, G1TraceConcRefinement, false, \ diagnostic(bool, G1TraceConcRefinement, false, \
"Trace G1 concurrent refinement") \ "Trace G1 concurrent refinement") \
\ \
product(intx, G1MarkStackSize, 2 * 1024 * 1024, \
"Size of the mark stack for concurrent marking.") \
\
product(intx, G1MarkRegionStackSize, 1024 * 1024, \ product(intx, G1MarkRegionStackSize, 1024 * 1024, \
"Size of the region stack for concurrent marking.") \ "Size of the region stack for concurrent marking.") \
\ \
......
...@@ -176,6 +176,7 @@ arguments.cpp management.hpp ...@@ -176,6 +176,7 @@ arguments.cpp management.hpp
arguments.cpp oop.inline.hpp arguments.cpp oop.inline.hpp
arguments.cpp os_<os_family>.inline.hpp arguments.cpp os_<os_family>.inline.hpp
arguments.cpp referenceProcessor.hpp arguments.cpp referenceProcessor.hpp
arguments.cpp taskqueue.hpp
arguments.cpp universe.inline.hpp arguments.cpp universe.inline.hpp
arguments.cpp vm_version_<arch>.hpp arguments.cpp vm_version_<arch>.hpp
......
...@@ -1203,6 +1203,11 @@ void Arguments::set_cms_and_parnew_gc_flags() { ...@@ -1203,6 +1203,11 @@ void Arguments::set_cms_and_parnew_gc_flags() {
if (!FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim) || !FLAG_IS_DEFAULT(OldPLABWeight)) { if (!FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim) || !FLAG_IS_DEFAULT(OldPLABWeight)) {
CFLS_LAB::modify_initialization(OldPLABSize, OldPLABWeight); CFLS_LAB::modify_initialization(OldPLABSize, OldPLABWeight);
} }
if (PrintGCDetails && Verbose) {
tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk",
MarkStackSize / K, MarkStackSizeMax / K);
tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
}
} }
#endif // KERNEL #endif // KERNEL
...@@ -1339,6 +1344,17 @@ void Arguments::set_g1_gc_flags() { ...@@ -1339,6 +1344,17 @@ void Arguments::set_g1_gc_flags() {
if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) { if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) {
FLAG_SET_DEFAULT(MaxGCPauseMillis, 200); FLAG_SET_DEFAULT(MaxGCPauseMillis, 200);
} }
if (FLAG_IS_DEFAULT(MarkStackSize)) {
// Size as a multiple of TaskQueueSuper::N which is larger
// for 64-bit.
FLAG_SET_DEFAULT(MarkStackSize, 128 * TaskQueueSuper::total_size());
}
if (PrintGCDetails && Verbose) {
tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk",
MarkStackSize / K, MarkStackSizeMax / K);
tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
}
} }
void Arguments::set_heap_size() { void Arguments::set_heap_size() {
...@@ -1800,6 +1816,29 @@ static bool match_option(const JavaVMOption* option, const char** names, const c ...@@ -1800,6 +1816,29 @@ static bool match_option(const JavaVMOption* option, const char** names, const c
return false; return false;
} }
bool Arguments::parse_uintx(const char* value,
uintx* uintx_arg,
uintx min_size) {
// Check the sign first since atomull() parses only unsigned values.
bool value_is_positive = !(*value == '-');
if (value_is_positive) {
julong n;
bool good_return = atomull(value, &n);
if (good_return) {
bool above_minimum = n >= min_size;
bool value_is_too_large = n > max_uintx;
if (above_minimum && !value_is_too_large) {
*uintx_arg = n;
return true;
}
}
}
return false;
}
Arguments::ArgsRange Arguments::parse_memory_size(const char* s, Arguments::ArgsRange Arguments::parse_memory_size(const char* s,
julong* long_arg, julong* long_arg,
julong min_size) { julong min_size) {
...@@ -2458,6 +2497,37 @@ SOLARIS_ONLY( ...@@ -2458,6 +2497,37 @@ SOLARIS_ONLY(
jio_fprintf(defaultStream::error_stream(), jio_fprintf(defaultStream::error_stream(),
"Please use -XX:YoungPLABSize in place of " "Please use -XX:YoungPLABSize in place of "
"-XX:ParallelGCToSpaceAllocBufferSize in the future\n"); "-XX:ParallelGCToSpaceAllocBufferSize in the future\n");
} else if (match_option(option, "-XX:CMSMarkStackSize=", &tail) ||
match_option(option, "-XX:G1MarkStackSize=", &tail)) {
julong stack_size = 0;
ArgsRange errcode = parse_memory_size(tail, &stack_size, 1);
if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(),
"Invalid mark stack size: %s\n", option->optionString);
describe_range_error(errcode);
return JNI_EINVAL;
}
FLAG_SET_CMDLINE(uintx, MarkStackSize, stack_size);
} else if (match_option(option, "-XX:CMSMarkStackSizeMax=", &tail)) {
julong max_stack_size = 0;
ArgsRange errcode = parse_memory_size(tail, &max_stack_size, 1);
if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(),
"Invalid maximum mark stack size: %s\n",
option->optionString);
describe_range_error(errcode);
return JNI_EINVAL;
}
FLAG_SET_CMDLINE(uintx, MarkStackSizeMax, max_stack_size);
} else if (match_option(option, "-XX:ParallelMarkingThreads=", &tail) ||
match_option(option, "-XX:ParallelCMSThreads=", &tail)) {
uintx conc_threads = 0;
if (!parse_uintx(tail, &conc_threads, 1)) {
jio_fprintf(defaultStream::error_stream(),
"Invalid concurrent threads: %s\n", option->optionString);
return JNI_EINVAL;
}
FLAG_SET_CMDLINE(uintx, ConcGCThreads, conc_threads);
} else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
// Skip -XX:Flags= since that case has already been handled // Skip -XX:Flags= since that case has already been handled
if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) { if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
......
...@@ -343,6 +343,12 @@ class Arguments : AllStatic { ...@@ -343,6 +343,12 @@ class Arguments : AllStatic {
static ArgsRange check_memory_size(julong size, julong min_size); static ArgsRange check_memory_size(julong size, julong min_size);
static ArgsRange parse_memory_size(const char* s, julong* long_arg, static ArgsRange parse_memory_size(const char* s, julong* long_arg,
julong min_size); julong min_size);
// Parse a string for a unsigned integer. Returns true if value
// is an unsigned integer greater than or equal to the minimum
// parameter passed and returns the value in uintx_arg. Returns
// false otherwise, with uintx_arg undefined.
static bool parse_uintx(const char* value, uintx* uintx_arg,
uintx min_size);
// methods to build strings from individual args // methods to build strings from individual args
static void build_jvm_args(const char* arg); static void build_jvm_args(const char* arg);
......
...@@ -1245,9 +1245,6 @@ class CommandLineFlags { ...@@ -1245,9 +1245,6 @@ class CommandLineFlags {
product(uintx, ParallelGCThreads, 0, \ product(uintx, ParallelGCThreads, 0, \
"Number of parallel threads parallel gc will use") \ "Number of parallel threads parallel gc will use") \
\ \
product(uintx, ParallelCMSThreads, 0, \
"Max number of threads CMS will use for concurrent work") \
\
develop(bool, ParallelOldGCSplitALot, false, \ develop(bool, ParallelOldGCSplitALot, false, \
"Provoke splitting (copying data from a young gen space to" \ "Provoke splitting (copying data from a young gen space to" \
"multiple destination spaces)") \ "multiple destination spaces)") \
...@@ -1258,8 +1255,8 @@ class CommandLineFlags { ...@@ -1258,8 +1255,8 @@ class CommandLineFlags {
develop(bool, TraceRegionTasksQueuing, false, \ develop(bool, TraceRegionTasksQueuing, false, \
"Trace the queuing of the region tasks") \ "Trace the queuing of the region tasks") \
\ \
product(uintx, ParallelMarkingThreads, 0, \ product(uintx, ConcGCThreads, 0, \
"Number of marking threads concurrent gc will use") \ "Number of threads concurrent gc will use") \
\ \
product(uintx, YoungPLABSize, 4096, \ product(uintx, YoungPLABSize, 4096, \
"Size of young gen promotion labs (in HeapWords)") \ "Size of young gen promotion labs (in HeapWords)") \
...@@ -1535,11 +1532,11 @@ class CommandLineFlags { ...@@ -1535,11 +1532,11 @@ class CommandLineFlags {
develop(bool, CMSOverflowEarlyRestoration, false, \ develop(bool, CMSOverflowEarlyRestoration, false, \
"Whether preserved marks should be restored early") \ "Whether preserved marks should be restored early") \
\ \
product(uintx, CMSMarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M), \ product(uintx, MarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M), \
"Size of CMS marking stack") \ "Size of marking stack") \
\ \
product(uintx, CMSMarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), \ product(uintx, MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), \
"Max size of CMS marking stack") \ "Max size of marking stack") \
\ \
notproduct(bool, CMSMarkStackOverflowALot, false, \ notproduct(bool, CMSMarkStackOverflowALot, false, \
"Whether we should simulate frequent marking stack / work queue" \ "Whether we should simulate frequent marking stack / work queue" \
......
...@@ -133,6 +133,9 @@ public: ...@@ -133,6 +133,9 @@ public:
// Maximum number of elements allowed in the queue. This is two less // Maximum number of elements allowed in the queue. This is two less
// than the actual queue size, for somewhat complicated reasons. // than the actual queue size, for somewhat complicated reasons.
uint max_elems() { return N - 2; } uint max_elems() { return N - 2; }
// Total size of queue.
static const uint total_size() { return N; }
}; };
template<class E> class GenericTaskQueue: public TaskQueueSuper { template<class E> class GenericTaskQueue: public TaskQueueSuper {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册