src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp

changeset 1965
79107c3a6bd5
parent 1934
e9ff18c4ace7
child 1966
215576b54709
     1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Thu Jun 10 08:27:35 2010 -0700
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri May 07 13:14:41 2010 -0400
     1.3 @@ -274,10 +274,64 @@
     1.4  
     1.5    // </NEW PREDICTION>
     1.6  
     1.7 +  // Below, we might need to calculate the pause time target based on
     1.8 +  // the pause interval. When we do so we are going to give G1 maximum
     1.9 +  // flexibility and allow it to do pauses when it needs to. So, we'll
    1.10 +  // arrange that the pause interval to be pause time target + 1 to
    1.11 +  // ensure that a) the pause time target is maximized with respect to
    1.12 +  // the pause interval and b) we maintain the invariant that pause
    1.13 +  // time target < pause interval. If the user does not want this
    1.14 +  // maximum flexibility, they will have to set the pause interval
    1.15 +  // explicitly.
    1.16 +
    1.17 +  // First make sure that, if either parameter is set, its value is
    1.18 +  // reasonable.
    1.19 +  if (!FLAG_IS_DEFAULT(MaxGCPauseMillis)) {
    1.20 +    if (MaxGCPauseMillis < 1) {
    1.21 +      vm_exit_during_initialization("MaxGCPauseMillis should be "
    1.22 +                                    "greater than 0");
    1.23 +    }
    1.24 +  }
    1.25 +  if (!FLAG_IS_DEFAULT(GCPauseIntervalMillis)) {
    1.26 +    if (GCPauseIntervalMillis < 1) {
    1.27 +      vm_exit_during_initialization("GCPauseIntervalMillis should be "
    1.28 +                                    "greater than 0");
    1.29 +    }
    1.30 +  }
    1.31 +
    1.32 +  // Then, if the pause time target parameter was not set, set it to
    1.33 +  // the default value.
    1.34 +  if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) {
    1.35 +    if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) {
    1.36 +      // The default pause time target in G1 is 200ms
    1.37 +      FLAG_SET_DEFAULT(MaxGCPauseMillis, 200);
    1.38 +    } else {
    1.39 +      // We do not allow the pause interval to be set without the
    1.40 +      // pause time target
    1.41 +      vm_exit_during_initialization("GCPauseIntervalMillis cannot be set "
    1.42 +                                    "without setting MaxGCPauseMillis");
    1.43 +    }
    1.44 +  }
    1.45 +
    1.46 +  // Then, if the interval parameter was not set, set it according to
    1.47 +  // the pause time target (this will also deal with the case when the
    1.48 +  // pause time target is the default value).
    1.49 +  if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) {
    1.50 +    FLAG_SET_DEFAULT(GCPauseIntervalMillis, MaxGCPauseMillis + 1);
    1.51 +  }
    1.52 +
    1.53 +  // Finally, make sure that the two parameters are consistent.
    1.54 +  if (MaxGCPauseMillis >= GCPauseIntervalMillis) {
    1.55 +    char buffer[256];
    1.56 +    jio_snprintf(buffer, 256,
    1.57 +                 "MaxGCPauseMillis (%u) should be less than "
    1.58 +                 "GCPauseIntervalMillis (%u)",
    1.59 +                 MaxGCPauseMillis, GCPauseIntervalMillis);
    1.60 +    vm_exit_during_initialization(buffer);
    1.61 +  }
    1.62 +
    1.63 +  double max_gc_time = (double) MaxGCPauseMillis / 1000.0;
    1.64    double time_slice  = (double) GCPauseIntervalMillis / 1000.0;
    1.65 -  double max_gc_time = (double) MaxGCPauseMillis / 1000.0;
    1.66 -  guarantee(max_gc_time < time_slice,
    1.67 -            "Max GC time should not be greater than the time slice");
    1.68    _mmu_tracker = new G1MMUTrackerQueue(time_slice, max_gc_time);
    1.69    _sigma = (double) G1ConfidencePercent / 100.0;
    1.70  

mercurial