Print this page
G1: Use SoftMaxHeapSize to guide GC heuristics

Split Close
Expand all
Collapse all
          --- old/src/hotspot/share/gc/g1/g1IHOPControl.cpp
          +++ new/src/hotspot/share/gc/g1/g1IHOPControl.cpp
↓ open down ↓ 100 lines elided ↑ open up ↑
 101  101    // free space  into account.
 102  102    // _heap_reserve is that part of the total heap capacity that is reserved for
 103  103    // eventual promotion failure.
 104  104    // _heap_waste is the amount of space will never be reclaimed in any
 105  105    // heap, so can not be used for allocation during marking and must always be
 106  106    // considered.
 107  107  
 108  108    double safe_total_heap_percentage = MIN2((double)(_heap_reserve_percent + _heap_waste_percent), 100.0);
 109  109  
 110  110    return (size_t)MIN2(
 111      -    G1CollectedHeap::heap()->max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0,
      111 +    G1CollectedHeap::heap()->soft_max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0,
 112  112      _target_occupancy * (100.0 - _heap_waste_percent) / 100.0
 113  113      );
 114  114  }
 115  115  
 116  116  double G1AdaptiveIHOPControl::predict(TruncatedSeq const* seq) const {
 117  117    return _predictor->predict_zero_bounded(seq);
 118  118  }
 119  119  
 120  120  bool G1AdaptiveIHOPControl::have_enough_data_for_prediction() const {
 121  121    return ((size_t)_marking_times_s.num() >= G1AdaptiveIHOPNumInitialSamples) &&
↓ open down ↓ 57 lines elided ↑ open up ↑
 179  179  
 180  180  void G1AdaptiveIHOPControl::send_trace_event(G1NewTracer* tracer) {
 181  181    G1IHOPControl::send_trace_event(tracer);
 182  182    tracer->report_adaptive_ihop_statistics(get_conc_mark_start_threshold(),
 183  183                                            actual_target_threshold(),
 184  184                                            G1CollectedHeap::heap()->used(),
 185  185                                            _last_unrestrained_young_size,
 186  186                                            predict(&_allocation_rate_s),
 187  187                                            predict(&_marking_times_s),
 188  188                                            have_enough_data_for_prediction());
      189 +}
      190 +
      191 +size_t G1AdaptiveIHOPControl::predict_unstrained_buffer_size() const {
      192 +  // Besides the young size, the promotion bytes of Prepare Mixed and 1st Mixed GC will be counted
      193 +  return  _last_unrestrained_young_size + _last_allocated_bytes * 2;
 189  194  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX