< prev index next >

src/hotspot/share/gc/g1/g1Policy.cpp

Print this page
rev 49676 : imported patch 8200723-suppress-predictions
rev 49678 : imported patch 8200426-sangheon-review
rev 49681 : imported patch 6672778-refactoring


 611   } else if (!this_pause_was_young_only) {
 612     // This is a mixed GC. Here we decide whether to continue doing more
 613     // mixed GCs or not.
 614     if (!next_gc_should_be_mixed("continue mixed GCs",
 615                                  "do not continue mixed GCs")) {
 616       collector_state()->set_in_young_only_phase(true);
 617 
 618       clear_collection_set_candidates();
 619       maybe_start_marking();
 620     }
 621   }
 622 
 623   _short_lived_surv_rate_group->start_adding_regions();
 624   // Do that for any other surv rate groups
 625 
 626   double scan_hcc_time_ms = G1HotCardCache::default_use_cache() ? average_time_ms(G1GCPhaseTimes::ScanHCC) : 0.0;
 627 
 628   if (update_stats) {
 629     double cost_per_card_ms = 0.0;
 630     if (_pending_cards > 0) {
 631       cost_per_card_ms = (average_time_ms(G1GCPhaseTimes::UpdateRS) - scan_hcc_time_ms) / (double) _pending_cards;
 632       _analytics->report_cost_per_card_ms(cost_per_card_ms);
 633     }
 634     _analytics->report_cost_scan_hcc(scan_hcc_time_ms);
 635 
 636     double cost_per_entry_ms = 0.0;
 637     if (cards_scanned > 10) {
 638       cost_per_entry_ms = average_time_ms(G1GCPhaseTimes::ScanRS) / (double) cards_scanned;
 639       _analytics->report_cost_per_entry_ms(cost_per_entry_ms, this_pause_was_young_only);
 640     }
 641 
 642     if (_max_rs_lengths > 0) {
 643       double cards_per_entry_ratio =
 644         (double) cards_scanned / (double) _max_rs_lengths;
 645       _analytics->report_cards_per_entry_ratio(cards_per_entry_ratio, this_pause_was_young_only);
 646     }
 647 
 648     // This is defensive. For a while _max_rs_lengths could get
 649     // smaller than _recorded_rs_lengths which was causing
 650     // rs_length_diff to get very large and mess up the RSet length
 651     // predictions. The reason was unsafe concurrent updates to the


 713   update_ihop_prediction(app_time_ms / 1000.0,
 714                          _bytes_allocated_in_old_since_last_gc,
 715                          last_unrestrained_young_length * HeapRegion::GrainBytes,
 716                          this_pause_was_young_only);
 717   _bytes_allocated_in_old_since_last_gc = 0;
 718 
 719   _ihop_control->send_trace_event(_g1h->gc_tracer_stw());
 720 
 721   // Note that _mmu_tracker->max_gc_time() returns the time in seconds.
 722   double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0;
 723 
 724   if (update_rs_time_goal_ms < scan_hcc_time_ms) {
 725     log_debug(gc, ergo, refine)("Adjust concurrent refinement thresholds (scanning the HCC expected to take longer than Update RS time goal)."
 726                                 "Update RS time goal: %1.2fms Scan HCC time: %1.2fms",
 727                                 update_rs_time_goal_ms, scan_hcc_time_ms);
 728 
 729     update_rs_time_goal_ms = 0;
 730   } else {
 731     update_rs_time_goal_ms -= scan_hcc_time_ms;
 732   }
 733   _g1h->concurrent_refine()->adjust(average_time_ms(G1GCPhaseTimes::UpdateRS) - scan_hcc_time_ms,
 734                                    phase_times()->sum_thread_work_items(G1GCPhaseTimes::UpdateRS),
 735                                    update_rs_time_goal_ms);
 736 
 737   cset_chooser()->verify();
 738 }
 739 
 740 G1IHOPControl* G1Policy::create_ihop_control(const G1Predictions* predictor){
 741   if (G1UseAdaptiveIHOP) {
 742     return new G1AdaptiveIHOPControl(InitiatingHeapOccupancyPercent,
 743                                      predictor,
 744                                      G1ReservePercent,
 745                                      G1HeapWastePercent);
 746   } else {
 747     return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent);
 748   }
 749 }
 750 
 751 void G1Policy::update_ihop_prediction(double mutator_time_s,
 752                                       size_t mutator_alloc_bytes,
 753                                       size_t young_gen_size,




 611   } else if (!this_pause_was_young_only) {
 612     // This is a mixed GC. Here we decide whether to continue doing more
 613     // mixed GCs or not.
 614     if (!next_gc_should_be_mixed("continue mixed GCs",
 615                                  "do not continue mixed GCs")) {
 616       collector_state()->set_in_young_only_phase(true);
 617 
 618       clear_collection_set_candidates();
 619       maybe_start_marking();
 620     }
 621   }
 622 
 623   _short_lived_surv_rate_group->start_adding_regions();
 624   // Do that for any other surv rate groups
 625 
 626   double scan_hcc_time_ms = G1HotCardCache::default_use_cache() ? average_time_ms(G1GCPhaseTimes::ScanHCC) : 0.0;
 627 
 628   if (update_stats) {
 629     double cost_per_card_ms = 0.0;
 630     if (_pending_cards > 0) {
 631       cost_per_card_ms = (average_time_ms(G1GCPhaseTimes::UpdateRS)) / (double) _pending_cards;
 632       _analytics->report_cost_per_card_ms(cost_per_card_ms);
 633     }
 634     _analytics->report_cost_scan_hcc(scan_hcc_time_ms);
 635 
 636     double cost_per_entry_ms = 0.0;
 637     if (cards_scanned > 10) {
 638       cost_per_entry_ms = average_time_ms(G1GCPhaseTimes::ScanRS) / (double) cards_scanned;
 639       _analytics->report_cost_per_entry_ms(cost_per_entry_ms, this_pause_was_young_only);
 640     }
 641 
 642     if (_max_rs_lengths > 0) {
 643       double cards_per_entry_ratio =
 644         (double) cards_scanned / (double) _max_rs_lengths;
 645       _analytics->report_cards_per_entry_ratio(cards_per_entry_ratio, this_pause_was_young_only);
 646     }
 647 
 648     // This is defensive. For a while _max_rs_lengths could get
 649     // smaller than _recorded_rs_lengths which was causing
 650     // rs_length_diff to get very large and mess up the RSet length
 651     // predictions. The reason was unsafe concurrent updates to the


 713   update_ihop_prediction(app_time_ms / 1000.0,
 714                          _bytes_allocated_in_old_since_last_gc,
 715                          last_unrestrained_young_length * HeapRegion::GrainBytes,
 716                          this_pause_was_young_only);
 717   _bytes_allocated_in_old_since_last_gc = 0;
 718 
 719   _ihop_control->send_trace_event(_g1h->gc_tracer_stw());
 720 
 721   // Note that _mmu_tracker->max_gc_time() returns the time in seconds.
 722   double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0;
 723 
 724   if (update_rs_time_goal_ms < scan_hcc_time_ms) {
 725     log_debug(gc, ergo, refine)("Adjust concurrent refinement thresholds (scanning the HCC expected to take longer than Update RS time goal)."
 726                                 "Update RS time goal: %1.2fms Scan HCC time: %1.2fms",
 727                                 update_rs_time_goal_ms, scan_hcc_time_ms);
 728 
 729     update_rs_time_goal_ms = 0;
 730   } else {
 731     update_rs_time_goal_ms -= scan_hcc_time_ms;
 732   }
 733   _g1h->concurrent_refine()->adjust(average_time_ms(G1GCPhaseTimes::UpdateRS),
 734                                     phase_times()->sum_thread_work_items(G1GCPhaseTimes::UpdateRS),
 735                                     update_rs_time_goal_ms);
 736 
 737   cset_chooser()->verify();
 738 }
 739 
 740 G1IHOPControl* G1Policy::create_ihop_control(const G1Predictions* predictor){
 741   if (G1UseAdaptiveIHOP) {
 742     return new G1AdaptiveIHOPControl(InitiatingHeapOccupancyPercent,
 743                                      predictor,
 744                                      G1ReservePercent,
 745                                      G1HeapWastePercent);
 746   } else {
 747     return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent);
 748   }
 749 }
 750 
 751 void G1Policy::update_ihop_prediction(double mutator_time_s,
 752                                       size_t mutator_alloc_bytes,
 753                                       size_t young_gen_size,


< prev index next >