1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Thu Jan 12 00:06:47 2012 -0800 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Wed Jan 25 12:58:23 2012 -0500 1.3 @@ -141,6 +141,7 @@ 1.4 1.5 _cur_clear_ct_time_ms(0.0), 1.6 _mark_closure_time_ms(0.0), 1.7 + _root_region_scan_wait_time_ms(0.0), 1.8 1.9 _cur_ref_proc_time_ms(0.0), 1.10 _cur_ref_enq_time_ms(0.0), 1.11 @@ -903,19 +904,10 @@ 1.12 gclog_or_tty->print(" (%s)", gcs_are_young() ? "young" : "mixed"); 1.13 } 1.14 1.15 - if (!during_initial_mark_pause()) { 1.16 - // We only need to do this here as the policy will only be applied 1.17 - // to the GC we're about to start. so, no point is calculating this 1.18 - // every time we calculate / recalculate the target young length. 1.19 - update_survivors_policy(); 1.20 - } else { 1.21 - // The marking phase has a "we only copy implicitly live 1.22 - // objects during marking" invariant. The easiest way to ensure it 1.23 - // holds is not to allocate any survivor regions and tenure all 1.24 - // objects. In the future we might change this and handle survivor 1.25 - // regions specially during marking. 1.26 - tenure_all_objects(); 1.27 - } 1.28 + // We only need to do this here as the policy will only be applied 1.29 + // to the GC we're about to start. so, no point is calculating this 1.30 + // every time we calculate / recalculate the target young length. 1.31 + update_survivors_policy(); 1.32 1.33 assert(_g1->used() == _g1->recalculate_used(), 1.34 err_msg("sanity, used: "SIZE_FORMAT" recalculate_used: "SIZE_FORMAT, 1.35 @@ -967,6 +959,9 @@ 1.36 // This is initialized to zero here and is set during 1.37 // the evacuation pause if marking is in progress. 1.38 _cur_satb_drain_time_ms = 0.0; 1.39 + // This is initialized to zero here and is set during the evacuation 1.40 + // pause if we actually waited for the root region scanning to finish. 1.41 + _root_region_scan_wait_time_ms = 0.0; 1.42 1.43 _last_gc_was_young = false; 1.44 1.45 @@ -1271,6 +1266,10 @@ 1.46 // is in progress. 1.47 other_time_ms -= _cur_satb_drain_time_ms; 1.48 1.49 + // Subtract the root region scanning wait time. It's initialized to 1.50 + // zero at the start of the pause. 1.51 + other_time_ms -= _root_region_scan_wait_time_ms; 1.52 + 1.53 if (parallel) { 1.54 other_time_ms -= _cur_collection_par_time_ms; 1.55 } else { 1.56 @@ -1303,6 +1302,8 @@ 1.57 // each other. Therefore we unconditionally record the SATB drain 1.58 // time - even if it's zero. 1.59 body_summary->record_satb_drain_time_ms(_cur_satb_drain_time_ms); 1.60 + body_summary->record_root_region_scan_wait_time_ms( 1.61 + _root_region_scan_wait_time_ms); 1.62 1.63 body_summary->record_ext_root_scan_time_ms(ext_root_scan_time); 1.64 body_summary->record_satb_filtering_time_ms(satb_filtering_time); 1.65 @@ -1399,6 +1400,9 @@ 1.66 (last_pause_included_initial_mark) ? " (initial-mark)" : "", 1.67 elapsed_ms / 1000.0); 1.68 1.69 + if (_root_region_scan_wait_time_ms > 0.0) { 1.70 + print_stats(1, "Root Region Scan Waiting", _root_region_scan_wait_time_ms); 1.71 + } 1.72 if (parallel) { 1.73 print_stats(1, "Parallel Time", _cur_collection_par_time_ms); 1.74 print_par_stats(2, "GC Worker Start", _par_last_gc_worker_start_times_ms); 1.75 @@ -2002,6 +2006,7 @@ 1.76 if (summary->get_total_seq()->num() > 0) { 1.77 print_summary_sd(0, "Evacuation Pauses", summary->get_total_seq()); 1.78 if (body_summary != NULL) { 1.79 + print_summary(1, "Root Region Scan Wait", body_summary->get_root_region_scan_wait_seq()); 1.80 if (parallel) { 1.81 print_summary(1, "Parallel Time", body_summary->get_parallel_seq()); 1.82 print_summary(2, "Ext Root Scanning", body_summary->get_ext_root_scan_seq()); 1.83 @@ -2043,15 +2048,17 @@ 1.84 // parallel 1.85 NumberSeq* other_parts[] = { 1.86 body_summary->get_satb_drain_seq(), 1.87 + body_summary->get_root_region_scan_wait_seq(), 1.88 body_summary->get_parallel_seq(), 1.89 body_summary->get_clear_ct_seq() 1.90 }; 1.91 calc_other_times_ms = NumberSeq(summary->get_total_seq(), 1.92 - 3, other_parts); 1.93 + 4, other_parts); 1.94 } else { 1.95 // serial 1.96 NumberSeq* other_parts[] = { 1.97 body_summary->get_satb_drain_seq(), 1.98 + body_summary->get_root_region_scan_wait_seq(), 1.99 body_summary->get_update_rs_seq(), 1.100 body_summary->get_ext_root_scan_seq(), 1.101 body_summary->get_satb_filtering_seq(), 1.102 @@ -2059,7 +2066,7 @@ 1.103 body_summary->get_obj_copy_seq() 1.104 }; 1.105 calc_other_times_ms = NumberSeq(summary->get_total_seq(), 1.106 - 6, other_parts); 1.107 + 7, other_parts); 1.108 } 1.109 check_other_times(1, summary->get_other_seq(), &calc_other_times_ms); 1.110 }