提交 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,
_processor_count = os::active_processor_count();
if (CMSConcurrentMTEnabled && (ParallelCMSThreads > 1)) {
if (CMSConcurrentMTEnabled && (ConcGCThreads > 1)) {
assert(_processor_count > 0, "Processor count is suspect");
_concurrent_processor_count = MIN2((uint) ParallelCMSThreads,
_concurrent_processor_count = MIN2((uint) ConcGCThreads,
(uint) _processor_count);
} else {
_concurrent_processor_count = 1;
......
......@@ -606,7 +606,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
assert(_modUnionTable.covers(_span), "_modUnionTable inconsistency?");
}
if (!_markStack.allocate(CMSMarkStackSize)) {
if (!_markStack.allocate(MarkStackSize)) {
warning("Failed to allocate CMS Marking Stack");
return;
}
......@@ -617,13 +617,13 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
// Support for multi-threaded concurrent phases
if (ParallelGCThreads > 0 && CMSConcurrentMTEnabled) {
if (FLAG_IS_DEFAULT(ParallelCMSThreads)) {
if (FLAG_IS_DEFAULT(ConcGCThreads)) {
// 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",
ParallelCMSThreads, true);
ConcGCThreads, true);
if (_conc_workers == NULL) {
warning("GC/CMS: _conc_workers allocation failure: "
"forcing -CMSConcurrentMTEnabled");
......@@ -634,13 +634,13 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
}
}
if (!CMSConcurrentMTEnabled) {
ParallelCMSThreads = 0;
ConcGCThreads = 0;
} else {
// Turn off CMSCleanOnEnter optimization temporarily for
// the MT case where it's not fixed yet; see 6178663.
CMSCleanOnEnter = false;
}
assert((_conc_workers != NULL) == (ParallelCMSThreads > 1),
assert((_conc_workers != NULL) == (ConcGCThreads > 1),
"Inconsistency");
// Parallel task queues; these are shared for the
......@@ -648,7 +648,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
// are not shared with parallel scavenge (ParNew).
{
uint i;
uint num_queues = (uint) MAX2(ParallelGCThreads, ParallelCMSThreads);
uint num_queues = (uint) MAX2(ParallelGCThreads, ConcGCThreads);
if ((CMSParallelRemarkEnabled || CMSConcurrentMTEnabled
|| ParallelRefProcEnabled)
......@@ -3657,7 +3657,7 @@ bool CMSCollector::markFromRootsWork(bool asynch) {
assert(_revisitStack.isEmpty(), "tabula rasa");
DEBUG_ONLY(RememberKlassesChecker cmx(should_unload_classes());)
bool result = false;
if (CMSConcurrentMTEnabled && ParallelCMSThreads > 0) {
if (CMSConcurrentMTEnabled && ConcGCThreads > 0) {
result = do_marking_mt(asynch);
} else {
result = do_marking_st(asynch);
......@@ -4174,10 +4174,10 @@ void CMSConcMarkingTask::coordinator_yield() {
}
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
// 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* perm_space = _permGen->cmsSpace();
......@@ -6429,8 +6429,8 @@ bool CMSMarkStack::allocate(size_t size) {
// For now we take the expedient path of just disabling the
// messages for the problematic case.)
void CMSMarkStack::expand() {
assert(_capacity <= CMSMarkStackSizeMax, "stack bigger than permitted");
if (_capacity == CMSMarkStackSizeMax) {
assert(_capacity <= MarkStackSizeMax, "stack bigger than permitted");
if (_capacity == MarkStackSizeMax) {
if (_hit_limit++ == 0 && !CMSConcurrentMTEnabled && PrintGCDetails) {
// We print a warning message only once per CMS cycle.
gclog_or_tty->print_cr(" (benign) Hit CMSMarkStack max size limit");
......@@ -6438,7 +6438,7 @@ void CMSMarkStack::expand() {
return;
}
// 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
// get the double capacity that we desired.
ReservedSpace rs(ReservedSpace::allocation_align_size_up(
......
......@@ -447,7 +447,7 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs,
gclog_or_tty->print_cr("[global] init, heap start = "PTR_FORMAT", "
"heap end = "PTR_FORMAT, _heap_start, _heap_end);
_markStack.allocate(G1MarkStackSize);
_markStack.allocate(MarkStackSize);
_regionStack.allocate(G1MarkRegionStackSize);
// Create & start a ConcurrentMark thread.
......@@ -483,8 +483,8 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs,
_accum_task_vtime[i] = 0.0;
}
if (ParallelMarkingThreads > ParallelGCThreads) {
vm_exit_during_initialization("Can't have more ParallelMarkingThreads "
if (ConcGCThreads > ParallelGCThreads) {
vm_exit_during_initialization("Can't have more ConcGCThreads "
"than ParallelGCThreads.");
}
if (ParallelGCThreads == 0) {
......@@ -494,11 +494,11 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs,
_sleep_factor = 0.0;
_marking_task_overhead = 1.0;
} else {
if (ParallelMarkingThreads > 0) {
// notice that ParallelMarkingThreads overwrites G1MarkingOverheadPercent
if (ConcGCThreads > 0) {
// notice that ConcGCThreads overwrites G1MarkingOverheadPercent
// if both are set
_parallel_marking_threads = ParallelMarkingThreads;
_parallel_marking_threads = ConcGCThreads;
_sleep_factor = 0.0;
_marking_task_overhead = 1.0;
} else if (G1MarkingOverheadPercent > 0) {
......
......@@ -88,9 +88,6 @@
diagnostic(bool, G1TraceConcRefinement, false, \
"Trace G1 concurrent refinement") \
\
product(intx, G1MarkStackSize, 2 * 1024 * 1024, \
"Size of the mark stack for concurrent marking.") \
\
product(intx, G1MarkRegionStackSize, 1024 * 1024, \
"Size of the region stack for concurrent marking.") \
\
......
......@@ -176,6 +176,7 @@ arguments.cpp management.hpp
arguments.cpp oop.inline.hpp
arguments.cpp os_<os_family>.inline.hpp
arguments.cpp referenceProcessor.hpp
arguments.cpp taskqueue.hpp
arguments.cpp universe.inline.hpp
arguments.cpp vm_version_<arch>.hpp
......
......@@ -1203,6 +1203,11 @@ void Arguments::set_cms_and_parnew_gc_flags() {
if (!FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim) || !FLAG_IS_DEFAULT(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
......@@ -1339,6 +1344,17 @@ void Arguments::set_g1_gc_flags() {
if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) {
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() {
......@@ -1800,6 +1816,29 @@ static bool match_option(const JavaVMOption* option, const char** names, const c
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,
julong* long_arg,
julong min_size) {
......@@ -2458,6 +2497,37 @@ SOLARIS_ONLY(
jio_fprintf(defaultStream::error_stream(),
"Please use -XX:YoungPLABSize in place of "
"-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
// Skip -XX:Flags= since that case has already been handled
if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
......
......@@ -343,6 +343,12 @@ class Arguments : AllStatic {
static ArgsRange check_memory_size(julong size, julong min_size);
static ArgsRange parse_memory_size(const char* s, julong* long_arg,
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
static void build_jvm_args(const char* arg);
......
......@@ -1245,9 +1245,6 @@ class CommandLineFlags {
product(uintx, ParallelGCThreads, 0, \
"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, \
"Provoke splitting (copying data from a young gen space to" \
"multiple destination spaces)") \
......@@ -1258,8 +1255,8 @@ class CommandLineFlags {
develop(bool, TraceRegionTasksQueuing, false, \
"Trace the queuing of the region tasks") \
\
product(uintx, ParallelMarkingThreads, 0, \
"Number of marking threads concurrent gc will use") \
product(uintx, ConcGCThreads, 0, \
"Number of threads concurrent gc will use") \
\
product(uintx, YoungPLABSize, 4096, \
"Size of young gen promotion labs (in HeapWords)") \
......@@ -1535,11 +1532,11 @@ class CommandLineFlags {
develop(bool, CMSOverflowEarlyRestoration, false, \
"Whether preserved marks should be restored early") \
\
product(uintx, CMSMarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M), \
"Size of CMS marking stack") \
product(uintx, MarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M), \
"Size of marking stack") \
\
product(uintx, CMSMarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), \
"Max size of CMS marking stack") \
product(uintx, MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), \
"Max size of marking stack") \
\
notproduct(bool, CMSMarkStackOverflowALot, false, \
"Whether we should simulate frequent marking stack / work queue" \
......
......@@ -133,6 +133,9 @@ public:
// Maximum number of elements allowed in the queue. This is two less
// than the actual queue size, for somewhat complicated reasons.
uint max_elems() { return N - 2; }
// Total size of queue.
static const uint total_size() { return N; }
};
template<class E> class GenericTaskQueue: public TaskQueueSuper {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册