Print this page
G1: Use SoftMaxHeapSize to guide GC heuristics

Split Close
Expand all
Collapse all
          --- old/src/hotspot/share/gc/g1/g1Policy.cpp
          +++ new/src/hotspot/share/gc/g1/g1Policy.cpp
↓ open down ↓ 671 lines elided ↑ open up ↑
 672  672      uint regions_allocated = _collection_set->eden_region_length();
 673  673      double alloc_rate_ms = (double) regions_allocated / app_time_ms;
 674  674      _analytics->report_alloc_rate_ms(alloc_rate_ms);
 675  675  
 676  676      double interval_ms =
 677  677        (end_time_sec - _analytics->last_known_gc_end_time_sec()) * 1000.0;
 678  678      _analytics->update_recent_gc_times(end_time_sec, pause_time_ms);
 679  679      _analytics->compute_pause_time_ratio(interval_ms, pause_time_ms);
 680  680    }
 681  681  
      682 +  if (collector_state()->finish_of_mixed_gc()) {
      683 +    collector_state()->set_finish_of_mixed_gc(false);
      684 +  }
 682  685    if (collector_state()->in_young_gc_before_mixed()) {
 683  686      assert(!this_pause_included_initial_mark, "The young GC before mixed is not allowed to be an initial mark GC");
 684  687      // This has been the young GC before we start doing mixed GCs. We already
 685  688      // decided to start mixed GCs much earlier, so there is nothing to do except
 686  689      // advancing the state.
 687  690      collector_state()->set_in_young_only_phase(false);
 688  691      collector_state()->set_in_young_gc_before_mixed(false);
 689  692    } else if (!this_pause_was_young_only) {
 690  693      // This is a mixed GC. Here we decide whether to continue doing more
 691  694      // mixed GCs or not.
 692  695      if (!next_gc_should_be_mixed("continue mixed GCs",
 693  696                                   "do not continue mixed GCs")) {
 694  697        collector_state()->set_in_young_only_phase(true);
      698 +      collector_state()->set_finish_of_mixed_gc(true);
 695  699  
 696  700        clear_collection_set_candidates();
 697  701        maybe_start_marking();
 698  702      }
 699  703    }
 700  704  
 701  705    _eden_surv_rate_group->start_adding_regions();
 702  706  
 703  707    double merge_hcc_time_ms = average_time_ms(G1GCPhaseTimes::MergeHCC);
 704  708    if (update_stats) {
↓ open down ↓ 698 lines elided ↑ open up ↑
1403 1407      _collection_set->add_survivor_regions(curr);
1404 1408  
1405 1409      last = curr;
1406 1410    }
1407 1411    note_stop_adding_survivor_regions();
1408 1412  
1409 1413    // Don't clear the survivor list handles until the start of
1410 1414    // the next evacuation pause - we need it in order to re-tag
1411 1415    // the survivor regions from this evacuation pause as 'young'
1412 1416    // at the start of the next.
     1417 +}
     1418 +
     1419 +size_t G1Policy::minimum_desired_bytes_after_concurrent_mark(size_t used_bytes) {
     1420 +  size_t minimum_desired_buffer_size = _ihop_control->predict_unstrained_buffer_size();
     1421 +  return minimum_desired_buffer_size != 0 ?
     1422 +           minimum_desired_buffer_size : _young_list_max_length * HeapRegion::GrainBytes
     1423 +         + _reserve_regions * HeapRegion::GrainBytes + used_bytes;
1413 1424  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX