< prev index next >

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

Print this page
rev 9431 : dihop-changes
rev 9433 : imported patch erik-jmasa-review
rev 9434 : imported patch fix-evac-failure-needs-stats
rev 9435 : [mq]: mikael-erik-review


 135 
 136   // Incremental CSet attributes
 137   _inc_cset_build_state(Inactive),
 138   _inc_cset_head(NULL),
 139   _inc_cset_tail(NULL),
 140   _inc_cset_bytes_used_before(0),
 141   _inc_cset_max_finger(NULL),
 142   _inc_cset_recorded_rs_lengths(0),
 143   _inc_cset_recorded_rs_lengths_diffs(0),
 144   _inc_cset_predicted_elapsed_time_ms(0.0),
 145   _inc_cset_predicted_elapsed_time_ms_diffs(0.0),
 146 
 147   // add here any more surv rate groups
 148   _recorded_survivor_regions(0),
 149   _recorded_survivor_head(NULL),
 150   _recorded_survivor_tail(NULL),
 151   _survivors_age_table(true),
 152 
 153   _gc_overhead_perc(0.0),
 154 
 155   _last_old_allocated_bytes(0),
 156   _ihop_control(NULL),
 157   _initial_mark_to_mixed() {
 158 
 159   // SurvRateGroups below must be initialized after the predictor because they
 160   // indirectly use it through this object passed to their constructor.
 161   _short_lived_surv_rate_group =
 162     new SurvRateGroup(&_predictor, "Short Lived", G1YoungSurvRateNumRegionsSummary);
 163   _survivor_surv_rate_group =
 164     new SurvRateGroup(&_predictor, "Survivor", G1YoungSurvRateNumRegionsSummary);
 165 
 166   // Set up the region size and associated fields. Given that the
 167   // policy is created before the heap, we have to set this up here,
 168   // so it's done as soon as possible.
 169 
 170   // It would have been natural to pass initial_heap_byte_size() and
 171   // max_heap_byte_size() to setup_heap_region_size() but those have
 172   // not been set up at this point since they should be aligned with
 173   // the region size. So, there is a circular dependency here. We base
 174   // the region size on the heap size, but the heap size should be
 175   // aligned with the region size. To get around this we use the


 839   // transitions and make sure we start with young GCs after the Full GC.
 840   collector_state()->set_gcs_are_young(true);
 841   collector_state()->set_last_young_gc(false);
 842   collector_state()->set_initiate_conc_mark_if_possible(need_to_start_conc_mark("end of Full GC", 0));
 843   collector_state()->set_during_initial_mark_pause(false);
 844   collector_state()->set_in_marking_window(false);
 845   collector_state()->set_in_marking_window_im(false);
 846 
 847   _short_lived_surv_rate_group->start_adding_regions();
 848   // also call this on any additional surv rate groups
 849 
 850   record_survivor_regions(0, NULL, NULL);
 851 
 852   _free_regions_at_end_of_collection = _g1->num_free_regions();
 853   // Reset survivors SurvRateGroup.
 854   _survivor_surv_rate_group->reset();
 855   update_young_list_max_and_target_length();
 856   update_rs_lengths_prediction();
 857   _collectionSetChooser->clear();
 858 
 859   _last_old_allocated_bytes = 0;
 860 
 861   record_pause(FullGC, _full_collection_start_sec, end_sec);
 862 }
 863 
 864 void G1CollectorPolicy::record_stop_world_start() {
 865   _stop_world_start = os::elapsedTime();
 866 }
 867 
 868 void G1CollectorPolicy::record_collection_pause_start(double start_time_sec) {
 869   // We only need to do this here as the policy will only be applied
 870   // to the GC we're about to start. so, no point is calculating this
 871   // every time we calculate / recalculate the target young length.
 872   update_survivors_policy();
 873 
 874   assert(_g1->used() == _g1->recalculate_used(),
 875          "sanity, used: " SIZE_FORMAT " recalculate_used: " SIZE_FORMAT,
 876          _g1->used(), _g1->recalculate_used());
 877 
 878   double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0;
 879   _trace_young_gen_time_data.record_start_collection(s_w_t_ms);


1193                                                    old_cset_region_length());
1194     }
1195 
1196     _constant_other_time_ms_seq->add(constant_other_time_ms(pause_time_ms));
1197 
1198     _pending_cards_seq->add((double) _pending_cards);
1199     _rs_lengths_seq->add((double) _max_rs_lengths);
1200   }
1201 
1202   collector_state()->set_in_marking_window(new_in_marking_window);
1203   collector_state()->set_in_marking_window_im(new_in_marking_window_im);
1204   _free_regions_at_end_of_collection = _g1->num_free_regions();
1205   // IHOP control wants to know the expected young gen length if it were not
1206   // restrained by the heap reserve. Using the actual length would make the
1207   // prediction too small and the limit the young gen every time we get to the
1208   // predicted target occupancy.
1209   size_t last_unrestrained_young_length = update_young_list_max_and_target_length();
1210   update_rs_lengths_prediction();
1211 
1212   update_ihop_prediction(app_time_ms / 1000.0,
1213                          _last_old_allocated_bytes,
1214                          last_unrestrained_young_length * HeapRegion::GrainBytes);
1215   _last_old_allocated_bytes = 0;
1216 
1217   // Note that _mmu_tracker->max_gc_time() returns the time in seconds.
1218   double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0;
1219 
1220   double scan_hcc_time_ms = average_time_ms(G1GCPhaseTimes::ScanHCC);
1221 
1222   if (update_rs_time_goal_ms < scan_hcc_time_ms) {
1223     ergo_verbose2(ErgoTiming,
1224                   "adjust concurrent refinement thresholds",
1225                   ergo_format_reason("Scanning the HCC expected to take longer than Update RS time goal")
1226                   ergo_format_ms("Update RS time goal")
1227                   ergo_format_ms("Scan HCC time"),
1228                   update_rs_time_goal_ms,
1229                   scan_hcc_time_ms);
1230 
1231     update_rs_time_goal_ms = 0;
1232   } else {
1233     update_rs_time_goal_ms -= scan_hcc_time_ms;
1234   }
1235   adjust_concurrent_refinement(average_time_ms(G1GCPhaseTimes::UpdateRS) - scan_hcc_time_ms,




 135 
 136   // Incremental CSet attributes
 137   _inc_cset_build_state(Inactive),
 138   _inc_cset_head(NULL),
 139   _inc_cset_tail(NULL),
 140   _inc_cset_bytes_used_before(0),
 141   _inc_cset_max_finger(NULL),
 142   _inc_cset_recorded_rs_lengths(0),
 143   _inc_cset_recorded_rs_lengths_diffs(0),
 144   _inc_cset_predicted_elapsed_time_ms(0.0),
 145   _inc_cset_predicted_elapsed_time_ms_diffs(0.0),
 146 
 147   // add here any more surv rate groups
 148   _recorded_survivor_regions(0),
 149   _recorded_survivor_head(NULL),
 150   _recorded_survivor_tail(NULL),
 151   _survivors_age_table(true),
 152 
 153   _gc_overhead_perc(0.0),
 154 
 155   _bytes_allocated_in_old_since_last_gc(0),
 156   _ihop_control(NULL),
 157   _initial_mark_to_mixed() {
 158 
 159   // SurvRateGroups below must be initialized after the predictor because they
 160   // indirectly use it through this object passed to their constructor.
 161   _short_lived_surv_rate_group =
 162     new SurvRateGroup(&_predictor, "Short Lived", G1YoungSurvRateNumRegionsSummary);
 163   _survivor_surv_rate_group =
 164     new SurvRateGroup(&_predictor, "Survivor", G1YoungSurvRateNumRegionsSummary);
 165 
 166   // Set up the region size and associated fields. Given that the
 167   // policy is created before the heap, we have to set this up here,
 168   // so it's done as soon as possible.
 169 
 170   // It would have been natural to pass initial_heap_byte_size() and
 171   // max_heap_byte_size() to setup_heap_region_size() but those have
 172   // not been set up at this point since they should be aligned with
 173   // the region size. So, there is a circular dependency here. We base
 174   // the region size on the heap size, but the heap size should be
 175   // aligned with the region size. To get around this we use the


 839   // transitions and make sure we start with young GCs after the Full GC.
 840   collector_state()->set_gcs_are_young(true);
 841   collector_state()->set_last_young_gc(false);
 842   collector_state()->set_initiate_conc_mark_if_possible(need_to_start_conc_mark("end of Full GC", 0));
 843   collector_state()->set_during_initial_mark_pause(false);
 844   collector_state()->set_in_marking_window(false);
 845   collector_state()->set_in_marking_window_im(false);
 846 
 847   _short_lived_surv_rate_group->start_adding_regions();
 848   // also call this on any additional surv rate groups
 849 
 850   record_survivor_regions(0, NULL, NULL);
 851 
 852   _free_regions_at_end_of_collection = _g1->num_free_regions();
 853   // Reset survivors SurvRateGroup.
 854   _survivor_surv_rate_group->reset();
 855   update_young_list_max_and_target_length();
 856   update_rs_lengths_prediction();
 857   _collectionSetChooser->clear();
 858 
 859   _bytes_allocated_in_old_since_last_gc = 0;
 860 
 861   record_pause(FullGC, _full_collection_start_sec, end_sec);
 862 }
 863 
 864 void G1CollectorPolicy::record_stop_world_start() {
 865   _stop_world_start = os::elapsedTime();
 866 }
 867 
 868 void G1CollectorPolicy::record_collection_pause_start(double start_time_sec) {
 869   // We only need to do this here as the policy will only be applied
 870   // to the GC we're about to start. so, no point is calculating this
 871   // every time we calculate / recalculate the target young length.
 872   update_survivors_policy();
 873 
 874   assert(_g1->used() == _g1->recalculate_used(),
 875          "sanity, used: " SIZE_FORMAT " recalculate_used: " SIZE_FORMAT,
 876          _g1->used(), _g1->recalculate_used());
 877 
 878   double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0;
 879   _trace_young_gen_time_data.record_start_collection(s_w_t_ms);


1193                                                    old_cset_region_length());
1194     }
1195 
1196     _constant_other_time_ms_seq->add(constant_other_time_ms(pause_time_ms));
1197 
1198     _pending_cards_seq->add((double) _pending_cards);
1199     _rs_lengths_seq->add((double) _max_rs_lengths);
1200   }
1201 
1202   collector_state()->set_in_marking_window(new_in_marking_window);
1203   collector_state()->set_in_marking_window_im(new_in_marking_window_im);
1204   _free_regions_at_end_of_collection = _g1->num_free_regions();
1205   // IHOP control wants to know the expected young gen length if it were not
1206   // restrained by the heap reserve. Using the actual length would make the
1207   // prediction too small and the limit the young gen every time we get to the
1208   // predicted target occupancy.
1209   size_t last_unrestrained_young_length = update_young_list_max_and_target_length();
1210   update_rs_lengths_prediction();
1211 
1212   update_ihop_prediction(app_time_ms / 1000.0,
1213                          _bytes_allocated_in_old_since_last_gc,
1214                          last_unrestrained_young_length * HeapRegion::GrainBytes);
1215   _bytes_allocated_in_old_since_last_gc = 0;
1216 
1217   // Note that _mmu_tracker->max_gc_time() returns the time in seconds.
1218   double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0;
1219 
1220   double scan_hcc_time_ms = average_time_ms(G1GCPhaseTimes::ScanHCC);
1221 
1222   if (update_rs_time_goal_ms < scan_hcc_time_ms) {
1223     ergo_verbose2(ErgoTiming,
1224                   "adjust concurrent refinement thresholds",
1225                   ergo_format_reason("Scanning the HCC expected to take longer than Update RS time goal")
1226                   ergo_format_ms("Update RS time goal")
1227                   ergo_format_ms("Scan HCC time"),
1228                   update_rs_time_goal_ms,
1229                   scan_hcc_time_ms);
1230 
1231     update_rs_time_goal_ms = 0;
1232   } else {
1233     update_rs_time_goal_ms -= scan_hcc_time_ms;
1234   }
1235   adjust_concurrent_refinement(average_time_ms(G1GCPhaseTimes::UpdateRS) - scan_hcc_time_ms,


< prev index next >