Tue, 24 Feb 2009 15:50:23 -0500
6804746: G1: guarantee(variance() > -1.0,"variance should be >= 0") (due to evacuation failure)
Summary: Under certain circumstances (evacuation failure) the pause time is not communicated to the policy and, as a result, the pause time field is not initialized properly.
Reviewed-by: jmasa
1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Feb 20 11:12:26 2009 -0800 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Tue Feb 24 15:50:23 2009 -0500 1.3 @@ -2626,9 +2626,8 @@ 1.4 #endif // SCAN_ONLY_VERBOSE 1.5 1.6 double end_time_sec = os::elapsedTime(); 1.7 - if (!evacuation_failed()) { 1.8 - g1_policy()->record_pause_time((end_time_sec - start_time_sec)*1000.0); 1.9 - } 1.10 + double pause_time_ms = (end_time_sec - start_time_sec) * MILLIUNITS; 1.11 + g1_policy()->record_pause_time_ms(pause_time_ms); 1.12 GCOverheadReporter::recordSTWEnd(end_time_sec); 1.13 g1_policy()->record_collection_pause_end(popular_region != NULL, 1.14 abandoned);
2.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Fri Feb 20 11:12:26 2009 -0800 2.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Tue Feb 24 15:50:23 2009 -0500 2.3 @@ -1014,7 +1014,7 @@ 2.4 2.5 _all_full_gc_times_ms->add(full_gc_time_ms); 2.6 2.7 - update_recent_gc_times(end_sec, full_gc_time_sec); 2.8 + update_recent_gc_times(end_sec, full_gc_time_ms); 2.9 2.10 _g1->clear_full_collection(); 2.11 2.12 @@ -1475,6 +1475,7 @@ 2.13 size_t cur_used_bytes = _g1->used(); 2.14 assert(cur_used_bytes == _g1->recalculate_used(), "It should!"); 2.15 bool last_pause_included_initial_mark = false; 2.16 + bool update_stats = !abandoned && !_g1->evacuation_failed(); 2.17 2.18 #ifndef PRODUCT 2.19 if (G1YoungSurvRateVerbose) { 2.20 @@ -1535,7 +1536,7 @@ 2.21 2.22 _n_pauses++; 2.23 2.24 - if (!abandoned) { 2.25 + if (update_stats) { 2.26 _recent_CH_strong_roots_times_ms->add(_cur_CH_strong_roots_dur_ms); 2.27 _recent_G1_strong_roots_times_ms->add(_cur_G1_strong_roots_dur_ms); 2.28 _recent_evac_times_ms->add(evac_ms); 2.29 @@ -1636,7 +1637,7 @@ 2.30 double termination_time = avg_value(_par_last_termination_times_ms); 2.31 2.32 double parallel_other_time; 2.33 - if (!abandoned) { 2.34 + if (update_stats) { 2.35 MainBodySummary* body_summary = summary->main_body_summary(); 2.36 guarantee(body_summary != NULL, "should not be null!"); 2.37 2.38 @@ -1852,7 +1853,7 @@ 2.39 2.40 // <NEW PREDICTION> 2.41 2.42 - if (!popular && !abandoned) { 2.43 + if (!popular && update_stats) { 2.44 double pause_time_ms = elapsed_ms; 2.45 2.46 size_t diff = 0;
3.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Fri Feb 20 11:12:26 2009 -0800 3.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Tue Feb 24 15:50:23 2009 -0500 3.3 @@ -966,7 +966,7 @@ 3.4 record_termination_time(0, ms); 3.5 } 3.6 3.7 - void record_pause_time(double ms) { 3.8 + void record_pause_time_ms(double ms) { 3.9 _last_pause_time_ms = ms; 3.10 } 3.11