< prev index next >

src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp

Print this page
*** 89,11 ***
    // Therefore, we start by sorting the regions by garbage. Then we unconditionally add the best candidates
    // before we meet min_garbage. Then we add all candidates that fit with a garbage threshold before
    // we hit max_cset. When max_cset is hit, we terminate the cset selection. Note that in this scheme,
    // ShenandoahGarbageThreshold is the soft threshold which would be ignored until min_garbage is hit.
  
!   size_t capacity    = _space_info->soft_max_capacity();
    size_t max_cset    = (size_t)((1.0 * capacity / 100 * ShenandoahEvacReserve) / ShenandoahEvacWaste);
    size_t free_target = (capacity / 100 * ShenandoahMinFreeThreshold) + max_cset;
    size_t min_garbage = (free_target > actual_free ? (free_target - actual_free) : 0);
  
    log_info(gc, ergo)("Adaptive CSet Selection. Target Free: %zu%s, Actual Free: "
--- 89,11 ---
    // Therefore, we start by sorting the regions by garbage. Then we unconditionally add the best candidates
    // before we meet min_garbage. Then we add all candidates that fit with a garbage threshold before
    // we hit max_cset. When max_cset is hit, we terminate the cset selection. Note that in this scheme,
    // ShenandoahGarbageThreshold is the soft threshold which would be ignored until min_garbage is hit.
  
!   size_t capacity    = ShenandoahHeap::heap()->soft_max_capacity();
    size_t max_cset    = (size_t)((1.0 * capacity / 100 * ShenandoahEvacReserve) / ShenandoahEvacWaste);
    size_t free_target = (capacity / 100 * ShenandoahMinFreeThreshold) + max_cset;
    size_t min_garbage = (free_target > actual_free ? (free_target - actual_free) : 0);
  
    log_info(gc, ergo)("Adaptive CSet Selection. Target Free: %zu%s, Actual Free: "

*** 231,11 ***
  //
  //    For cases 1 and 2, we need to "quickly" recalibrate the average allocation rate whenever we detect a change
  //    in operation mode.  We want some way to decide that the average rate has changed, while keeping average
  //    allocation rate computation independent.
  bool ShenandoahAdaptiveHeuristics::should_start_gc() {
!   size_t capacity = _space_info->soft_max_capacity();
    size_t available = _space_info->soft_available();
    size_t allocated = _space_info->bytes_allocated_since_gc_start();
  
    log_debug(gc)("should_start_gc? available: %zu, soft_max_capacity: %zu"
                  ", allocated: %zu", available, capacity, allocated);
--- 231,11 ---
  //
  //    For cases 1 and 2, we need to "quickly" recalibrate the average allocation rate whenever we detect a change
  //    in operation mode.  We want some way to decide that the average rate has changed, while keeping average
  //    allocation rate computation independent.
  bool ShenandoahAdaptiveHeuristics::should_start_gc() {
!   size_t capacity = ShenandoahHeap::heap()->soft_max_capacity();
    size_t available = _space_info->soft_available();
    size_t allocated = _space_info->bytes_allocated_since_gc_start();
  
    log_debug(gc)("should_start_gc? available: %zu, soft_max_capacity: %zu"
                  ", allocated: %zu", available, capacity, allocated);

*** 347,14 ***
    _spike_threshold_sd = saturate(_spike_threshold_sd - amount, MINIMUM_CONFIDENCE, MAXIMUM_CONFIDENCE);
    log_debug(gc, ergo)("Spike threshold now: %.2f", _spike_threshold_sd);
  }
  
  size_t ShenandoahAdaptiveHeuristics::min_free_threshold() {
!   // Note that soft_max_capacity() / 100 * min_free_threshold is smaller than max_capacity() / 100 * min_free_threshold.
-   // We want to behave conservatively here, so use max_capacity().  By returning a larger value, we cause the GC to
-   // trigger when the remaining amount of free shrinks below the larger threshold.
-   return _space_info->max_capacity() / 100 * ShenandoahMinFreeThreshold;
  }
  
  ShenandoahAllocationRate::ShenandoahAllocationRate() :
    _last_sample_time(os::elapsedTime()),
    _last_sample_value(0),
--- 347,11 ---
    _spike_threshold_sd = saturate(_spike_threshold_sd - amount, MINIMUM_CONFIDENCE, MAXIMUM_CONFIDENCE);
    log_debug(gc, ergo)("Spike threshold now: %.2f", _spike_threshold_sd);
  }
  
  size_t ShenandoahAdaptiveHeuristics::min_free_threshold() {
!   return ShenandoahHeap::heap()->soft_max_capacity() / 100 * ShenandoahMinFreeThreshold;
  }
  
  ShenandoahAllocationRate::ShenandoahAllocationRate() :
    _last_sample_time(os::elapsedTime()),
    _last_sample_value(0),
< prev index next >