6928081: G1: rename parameters common with CMS

Wed, 24 Feb 2010 07:00:33 -0800

author
jmasa
date
Wed, 24 Feb 2010 07:00:33 -0800
changeset 1719
5f1f51edaff6
parent 1718
1c72304f1885
child 1720
a1c410de27e4

6928081: G1: rename parameters common with CMS
Summary: Rename marking stack sizing flags to be common between G1 and CMS
Reviewed-by: ysr, tonyp

src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/concurrentMark.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/g1_globals.hpp file | annotate | diff | comparison | revisions
src/share/vm/includeDB_core file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/globals.hpp file | annotate | diff | comparison | revisions
src/share/vm/utilities/taskqueue.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp	Tue Feb 23 23:14:34 2010 -0500
     1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp	Wed Feb 24 07:00:33 2010 -0800
     1.3 @@ -46,9 +46,9 @@
     1.4  
     1.5    _processor_count = os::active_processor_count();
     1.6  
     1.7 -  if (CMSConcurrentMTEnabled && (ParallelCMSThreads > 1)) {
     1.8 +  if (CMSConcurrentMTEnabled && (ConcGCThreads > 1)) {
     1.9      assert(_processor_count > 0, "Processor count is suspect");
    1.10 -    _concurrent_processor_count = MIN2((uint) ParallelCMSThreads,
    1.11 +    _concurrent_processor_count = MIN2((uint) ConcGCThreads,
    1.12                                         (uint) _processor_count);
    1.13    } else {
    1.14      _concurrent_processor_count = 1;
     2.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Tue Feb 23 23:14:34 2010 -0500
     2.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Feb 24 07:00:33 2010 -0800
     2.3 @@ -606,7 +606,7 @@
     2.4      assert(_modUnionTable.covers(_span), "_modUnionTable inconsistency?");
     2.5    }
     2.6  
     2.7 -  if (!_markStack.allocate(CMSMarkStackSize)) {
     2.8 +  if (!_markStack.allocate(MarkStackSize)) {
     2.9      warning("Failed to allocate CMS Marking Stack");
    2.10      return;
    2.11    }
    2.12 @@ -617,13 +617,13 @@
    2.13  
    2.14    // Support for multi-threaded concurrent phases
    2.15    if (ParallelGCThreads > 0 && CMSConcurrentMTEnabled) {
    2.16 -    if (FLAG_IS_DEFAULT(ParallelCMSThreads)) {
    2.17 +    if (FLAG_IS_DEFAULT(ConcGCThreads)) {
    2.18        // just for now
    2.19 -      FLAG_SET_DEFAULT(ParallelCMSThreads, (ParallelGCThreads + 3)/4);
    2.20 -    }
    2.21 -    if (ParallelCMSThreads > 1) {
    2.22 +      FLAG_SET_DEFAULT(ConcGCThreads, (ParallelGCThreads + 3)/4);
    2.23 +    }
    2.24 +    if (ConcGCThreads > 1) {
    2.25        _conc_workers = new YieldingFlexibleWorkGang("Parallel CMS Threads",
    2.26 -                                 ParallelCMSThreads, true);
    2.27 +                                 ConcGCThreads, true);
    2.28        if (_conc_workers == NULL) {
    2.29          warning("GC/CMS: _conc_workers allocation failure: "
    2.30                "forcing -CMSConcurrentMTEnabled");
    2.31 @@ -634,13 +634,13 @@
    2.32      }
    2.33    }
    2.34    if (!CMSConcurrentMTEnabled) {
    2.35 -    ParallelCMSThreads = 0;
    2.36 +    ConcGCThreads = 0;
    2.37    } else {
    2.38      // Turn off CMSCleanOnEnter optimization temporarily for
    2.39      // the MT case where it's not fixed yet; see 6178663.
    2.40      CMSCleanOnEnter = false;
    2.41    }
    2.42 -  assert((_conc_workers != NULL) == (ParallelCMSThreads > 1),
    2.43 +  assert((_conc_workers != NULL) == (ConcGCThreads > 1),
    2.44           "Inconsistency");
    2.45  
    2.46    // Parallel task queues; these are shared for the
    2.47 @@ -648,7 +648,7 @@
    2.48    // are not shared with parallel scavenge (ParNew).
    2.49    {
    2.50      uint i;
    2.51 -    uint num_queues = (uint) MAX2(ParallelGCThreads, ParallelCMSThreads);
    2.52 +    uint num_queues = (uint) MAX2(ParallelGCThreads, ConcGCThreads);
    2.53  
    2.54      if ((CMSParallelRemarkEnabled || CMSConcurrentMTEnabled
    2.55           || ParallelRefProcEnabled)
    2.56 @@ -3657,7 +3657,7 @@
    2.57    assert(_revisitStack.isEmpty(), "tabula rasa");
    2.58    DEBUG_ONLY(RememberKlassesChecker cmx(should_unload_classes());)
    2.59    bool result = false;
    2.60 -  if (CMSConcurrentMTEnabled && ParallelCMSThreads > 0) {
    2.61 +  if (CMSConcurrentMTEnabled && ConcGCThreads > 0) {
    2.62      result = do_marking_mt(asynch);
    2.63    } else {
    2.64      result = do_marking_st(asynch);
    2.65 @@ -4174,10 +4174,10 @@
    2.66  }
    2.67  
    2.68  bool CMSCollector::do_marking_mt(bool asynch) {
    2.69 -  assert(ParallelCMSThreads > 0 && conc_workers() != NULL, "precondition");
    2.70 +  assert(ConcGCThreads > 0 && conc_workers() != NULL, "precondition");
    2.71    // In the future this would be determined ergonomically, based
    2.72    // on #cpu's, # active mutator threads (and load), and mutation rate.
    2.73 -  int num_workers = ParallelCMSThreads;
    2.74 +  int num_workers = ConcGCThreads;
    2.75  
    2.76    CompactibleFreeListSpace* cms_space  = _cmsGen->cmsSpace();
    2.77    CompactibleFreeListSpace* perm_space = _permGen->cmsSpace();
    2.78 @@ -6429,8 +6429,8 @@
    2.79  // For now we take the expedient path of just disabling the
    2.80  // messages for the problematic case.)
    2.81  void CMSMarkStack::expand() {
    2.82 -  assert(_capacity <= CMSMarkStackSizeMax, "stack bigger than permitted");
    2.83 -  if (_capacity == CMSMarkStackSizeMax) {
    2.84 +  assert(_capacity <= MarkStackSizeMax, "stack bigger than permitted");
    2.85 +  if (_capacity == MarkStackSizeMax) {
    2.86      if (_hit_limit++ == 0 && !CMSConcurrentMTEnabled && PrintGCDetails) {
    2.87        // We print a warning message only once per CMS cycle.
    2.88        gclog_or_tty->print_cr(" (benign) Hit CMSMarkStack max size limit");
    2.89 @@ -6438,7 +6438,7 @@
    2.90      return;
    2.91    }
    2.92    // Double capacity if possible
    2.93 -  size_t new_capacity = MIN2(_capacity*2, CMSMarkStackSizeMax);
    2.94 +  size_t new_capacity = MIN2(_capacity*2, MarkStackSizeMax);
    2.95    // Do not give up existing stack until we have managed to
    2.96    // get the double capacity that we desired.
    2.97    ReservedSpace rs(ReservedSpace::allocation_align_size_up(
     3.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Tue Feb 23 23:14:34 2010 -0500
     3.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Feb 24 07:00:33 2010 -0800
     3.3 @@ -447,7 +447,7 @@
     3.4      gclog_or_tty->print_cr("[global] init, heap start = "PTR_FORMAT", "
     3.5                             "heap end = "PTR_FORMAT, _heap_start, _heap_end);
     3.6  
     3.7 -  _markStack.allocate(G1MarkStackSize);
     3.8 +  _markStack.allocate(MarkStackSize);
     3.9    _regionStack.allocate(G1MarkRegionStackSize);
    3.10  
    3.11    // Create & start a ConcurrentMark thread.
    3.12 @@ -483,8 +483,8 @@
    3.13      _accum_task_vtime[i] = 0.0;
    3.14    }
    3.15  
    3.16 -  if (ParallelMarkingThreads > ParallelGCThreads) {
    3.17 -    vm_exit_during_initialization("Can't have more ParallelMarkingThreads "
    3.18 +  if (ConcGCThreads > ParallelGCThreads) {
    3.19 +    vm_exit_during_initialization("Can't have more ConcGCThreads "
    3.20                                    "than ParallelGCThreads.");
    3.21    }
    3.22    if (ParallelGCThreads == 0) {
    3.23 @@ -494,11 +494,11 @@
    3.24      _sleep_factor             = 0.0;
    3.25      _marking_task_overhead    = 1.0;
    3.26    } else {
    3.27 -    if (ParallelMarkingThreads > 0) {
    3.28 -      // notice that ParallelMarkingThreads overwrites G1MarkingOverheadPercent
    3.29 +    if (ConcGCThreads > 0) {
    3.30 +      // notice that ConcGCThreads overwrites G1MarkingOverheadPercent
    3.31        // if both are set
    3.32  
    3.33 -      _parallel_marking_threads = ParallelMarkingThreads;
    3.34 +      _parallel_marking_threads = ConcGCThreads;
    3.35        _sleep_factor             = 0.0;
    3.36        _marking_task_overhead    = 1.0;
    3.37      } else if (G1MarkingOverheadPercent > 0) {
     4.1 --- a/src/share/vm/gc_implementation/g1/g1_globals.hpp	Tue Feb 23 23:14:34 2010 -0500
     4.2 +++ b/src/share/vm/gc_implementation/g1/g1_globals.hpp	Wed Feb 24 07:00:33 2010 -0800
     4.3 @@ -88,9 +88,6 @@
     4.4    diagnostic(bool, G1TraceConcRefinement, false,                            \
     4.5            "Trace G1 concurrent refinement")                                 \
     4.6                                                                              \
     4.7 -  product(intx, G1MarkStackSize, 2 * 1024 * 1024,                           \
     4.8 -          "Size of the mark stack for concurrent marking.")                 \
     4.9 -                                                                            \
    4.10    product(intx, G1MarkRegionStackSize, 1024 * 1024,                         \
    4.11            "Size of the region stack for concurrent marking.")               \
    4.12                                                                              \
     5.1 --- a/src/share/vm/includeDB_core	Tue Feb 23 23:14:34 2010 -0500
     5.2 +++ b/src/share/vm/includeDB_core	Wed Feb 24 07:00:33 2010 -0800
     5.3 @@ -176,6 +176,7 @@
     5.4  arguments.cpp                           oop.inline.hpp
     5.5  arguments.cpp                           os_<os_family>.inline.hpp
     5.6  arguments.cpp                           referenceProcessor.hpp
     5.7 +arguments.cpp                           taskqueue.hpp
     5.8  arguments.cpp                           universe.inline.hpp
     5.9  arguments.cpp                           vm_version_<arch>.hpp
    5.10  
     6.1 --- a/src/share/vm/runtime/arguments.cpp	Tue Feb 23 23:14:34 2010 -0500
     6.2 +++ b/src/share/vm/runtime/arguments.cpp	Wed Feb 24 07:00:33 2010 -0800
     6.3 @@ -1203,6 +1203,11 @@
     6.4    if (!FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim) || !FLAG_IS_DEFAULT(OldPLABWeight)) {
     6.5      CFLS_LAB::modify_initialization(OldPLABSize, OldPLABWeight);
     6.6    }
     6.7 +  if (PrintGCDetails && Verbose) {
     6.8 +    tty->print_cr("MarkStackSize: %uk  MarkStackSizeMax: %uk",
     6.9 +      MarkStackSize / K, MarkStackSizeMax / K);
    6.10 +    tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
    6.11 +  }
    6.12  }
    6.13  #endif // KERNEL
    6.14  
    6.15 @@ -1339,6 +1344,17 @@
    6.16    if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) {
    6.17      FLAG_SET_DEFAULT(MaxGCPauseMillis, 200);
    6.18    }
    6.19 +
    6.20 +  if (FLAG_IS_DEFAULT(MarkStackSize)) {
    6.21 +    // Size as a multiple of TaskQueueSuper::N which is larger
    6.22 +    // for 64-bit.
    6.23 +    FLAG_SET_DEFAULT(MarkStackSize, 128 * TaskQueueSuper::total_size());
    6.24 +  }
    6.25 +  if (PrintGCDetails && Verbose) {
    6.26 +    tty->print_cr("MarkStackSize: %uk  MarkStackSizeMax: %uk",
    6.27 +      MarkStackSize / K, MarkStackSizeMax / K);
    6.28 +    tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
    6.29 +  }
    6.30  }
    6.31  
    6.32  void Arguments::set_heap_size() {
    6.33 @@ -1800,6 +1816,29 @@
    6.34    return false;
    6.35  }
    6.36  
    6.37 +bool Arguments::parse_uintx(const char* value,
    6.38 +                            uintx* uintx_arg,
    6.39 +                            uintx min_size) {
    6.40 +
    6.41 +  // Check the sign first since atomull() parses only unsigned values.
    6.42 +  bool value_is_positive = !(*value == '-');
    6.43 +
    6.44 +  if (value_is_positive) {
    6.45 +    julong n;
    6.46 +    bool good_return = atomull(value, &n);
    6.47 +    if (good_return) {
    6.48 +      bool above_minimum = n >= min_size;
    6.49 +      bool value_is_too_large = n > max_uintx;
    6.50 +
    6.51 +      if (above_minimum && !value_is_too_large) {
    6.52 +        *uintx_arg = n;
    6.53 +        return true;
    6.54 +      }
    6.55 +    }
    6.56 +  }
    6.57 +  return false;
    6.58 +}
    6.59 +
    6.60  Arguments::ArgsRange Arguments::parse_memory_size(const char* s,
    6.61                                                    julong* long_arg,
    6.62                                                    julong min_size) {
    6.63 @@ -2458,6 +2497,37 @@
    6.64        jio_fprintf(defaultStream::error_stream(),
    6.65                    "Please use -XX:YoungPLABSize in place of "
    6.66                    "-XX:ParallelGCToSpaceAllocBufferSize in the future\n");
    6.67 +    } else if (match_option(option, "-XX:CMSMarkStackSize=", &tail) ||
    6.68 +               match_option(option, "-XX:G1MarkStackSize=", &tail)) {
    6.69 +      julong stack_size = 0;
    6.70 +      ArgsRange errcode = parse_memory_size(tail, &stack_size, 1);
    6.71 +      if (errcode != arg_in_range) {
    6.72 +        jio_fprintf(defaultStream::error_stream(),
    6.73 +                    "Invalid mark stack size: %s\n", option->optionString);
    6.74 +        describe_range_error(errcode);
    6.75 +        return JNI_EINVAL;
    6.76 +      }
    6.77 +      FLAG_SET_CMDLINE(uintx, MarkStackSize, stack_size);
    6.78 +    } else if (match_option(option, "-XX:CMSMarkStackSizeMax=", &tail)) {
    6.79 +      julong max_stack_size = 0;
    6.80 +      ArgsRange errcode = parse_memory_size(tail, &max_stack_size, 1);
    6.81 +      if (errcode != arg_in_range) {
    6.82 +        jio_fprintf(defaultStream::error_stream(),
    6.83 +                    "Invalid maximum mark stack size: %s\n",
    6.84 +                    option->optionString);
    6.85 +        describe_range_error(errcode);
    6.86 +        return JNI_EINVAL;
    6.87 +      }
    6.88 +      FLAG_SET_CMDLINE(uintx, MarkStackSizeMax, max_stack_size);
    6.89 +    } else if (match_option(option, "-XX:ParallelMarkingThreads=", &tail) ||
    6.90 +               match_option(option, "-XX:ParallelCMSThreads=", &tail)) {
    6.91 +      uintx conc_threads = 0;
    6.92 +      if (!parse_uintx(tail, &conc_threads, 1)) {
    6.93 +        jio_fprintf(defaultStream::error_stream(),
    6.94 +                    "Invalid concurrent threads: %s\n", option->optionString);
    6.95 +        return JNI_EINVAL;
    6.96 +      }
    6.97 +      FLAG_SET_CMDLINE(uintx, ConcGCThreads, conc_threads);
    6.98      } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
    6.99        // Skip -XX:Flags= since that case has already been handled
   6.100        if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
     7.1 --- a/src/share/vm/runtime/arguments.hpp	Tue Feb 23 23:14:34 2010 -0500
     7.2 +++ b/src/share/vm/runtime/arguments.hpp	Wed Feb 24 07:00:33 2010 -0800
     7.3 @@ -343,6 +343,12 @@
     7.4    static ArgsRange check_memory_size(julong size, julong min_size);
     7.5    static ArgsRange parse_memory_size(const char* s, julong* long_arg,
     7.6                                       julong min_size);
     7.7 +  // Parse a string for a unsigned integer.  Returns true if value
     7.8 +  // is an unsigned integer greater than or equal to the minimum
     7.9 +  // parameter passed and returns the value in uintx_arg.  Returns
    7.10 +  // false otherwise, with uintx_arg undefined.
    7.11 +  static bool parse_uintx(const char* value, uintx* uintx_arg,
    7.12 +                          uintx min_size);
    7.13  
    7.14    // methods to build strings from individual args
    7.15    static void build_jvm_args(const char* arg);
     8.1 --- a/src/share/vm/runtime/globals.hpp	Tue Feb 23 23:14:34 2010 -0500
     8.2 +++ b/src/share/vm/runtime/globals.hpp	Wed Feb 24 07:00:33 2010 -0800
     8.3 @@ -1245,9 +1245,6 @@
     8.4    product(uintx, ParallelGCThreads, 0,                                      \
     8.5            "Number of parallel threads parallel gc will use")                \
     8.6                                                                              \
     8.7 -  product(uintx, ParallelCMSThreads, 0,                                     \
     8.8 -          "Max number of threads CMS will use for concurrent work")         \
     8.9 -                                                                            \
    8.10    develop(bool, ParallelOldGCSplitALot, false,                              \
    8.11            "Provoke splitting (copying data from a young gen space to"       \
    8.12            "multiple destination spaces)")                                   \
    8.13 @@ -1258,8 +1255,8 @@
    8.14    develop(bool, TraceRegionTasksQueuing, false,                             \
    8.15            "Trace the queuing of the region tasks")                          \
    8.16                                                                              \
    8.17 -  product(uintx, ParallelMarkingThreads, 0,                                 \
    8.18 -          "Number of marking threads concurrent gc will use")               \
    8.19 +  product(uintx, ConcGCThreads, 0,                                          \
    8.20 +          "Number of threads concurrent gc will use")                       \
    8.21                                                                              \
    8.22    product(uintx, YoungPLABSize, 4096,                                       \
    8.23            "Size of young gen promotion labs (in HeapWords)")                \
    8.24 @@ -1535,11 +1532,11 @@
    8.25    develop(bool, CMSOverflowEarlyRestoration, false,                         \
    8.26            "Whether preserved marks should be restored early")               \
    8.27                                                                              \
    8.28 -  product(uintx, CMSMarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M),           \
    8.29 -          "Size of CMS marking stack")                                      \
    8.30 -                                                                            \
    8.31 -  product(uintx, CMSMarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M),       \
    8.32 -          "Max size of CMS marking stack")                                  \
    8.33 +  product(uintx, MarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M),              \
    8.34 +          "Size of marking stack")                                          \
    8.35 +                                                                            \
    8.36 +  product(uintx, MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M),          \
    8.37 +          "Max size of marking stack")                                      \
    8.38                                                                              \
    8.39    notproduct(bool, CMSMarkStackOverflowALot, false,                         \
    8.40            "Whether we should simulate frequent marking stack / work queue"  \
     9.1 --- a/src/share/vm/utilities/taskqueue.hpp	Tue Feb 23 23:14:34 2010 -0500
     9.2 +++ b/src/share/vm/utilities/taskqueue.hpp	Wed Feb 24 07:00:33 2010 -0800
     9.3 @@ -133,6 +133,9 @@
     9.4    // Maximum number of elements allowed in the queue.  This is two less
     9.5    // than the actual queue size, for somewhat complicated reasons.
     9.6    uint max_elems() { return N - 2; }
     9.7 +
     9.8 +  // Total size of queue.
     9.9 +  static const uint total_size() { return N; }
    9.10  };
    9.11  
    9.12  template<class E> class GenericTaskQueue: public TaskQueueSuper {

mercurial