提交 cac942d6 编写于 作者: T tonyp

7113012: G1: rename not-fully-young GCs as "mixed"

Summary: Renamed partially-young GCs as mixed and fully-young GCs as young. Change all external output that includes those terms (GC log and GC ergo log) as well as any comments, fields, methods, etc. The changeset also includes very minor code tidying up (added some curly brackets).
Reviewed-by: johnc, brutisso
上级 bc31332b
...@@ -1294,7 +1294,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc, ...@@ -1294,7 +1294,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
g1_policy()->stop_incremental_cset_building(); g1_policy()->stop_incremental_cset_building();
tear_down_region_sets(false /* free_list_only */); tear_down_region_sets(false /* free_list_only */);
g1_policy()->set_full_young_gcs(true); g1_policy()->set_gcs_are_young(true);
// See the comments in g1CollectedHeap.hpp and // See the comments in g1CollectedHeap.hpp and
// G1CollectedHeap::ref_processing_init() about // G1CollectedHeap::ref_processing_init() about
...@@ -3526,20 +3526,19 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { ...@@ -3526,20 +3526,19 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
// for the duration of this pause. // for the duration of this pause.
g1_policy()->decide_on_conc_mark_initiation(); g1_policy()->decide_on_conc_mark_initiation();
// We do not allow initial-mark to be piggy-backed on a // We do not allow initial-mark to be piggy-backed on a mixed GC.
// partially-young GC.
assert(!g1_policy()->during_initial_mark_pause() || assert(!g1_policy()->during_initial_mark_pause() ||
g1_policy()->full_young_gcs(), "sanity"); g1_policy()->gcs_are_young(), "sanity");
// We also do not allow partially-young GCs during marking. // We also do not allow mixed GCs during marking.
assert(!mark_in_progress() || g1_policy()->full_young_gcs(), "sanity"); assert(!mark_in_progress() || g1_policy()->gcs_are_young(), "sanity");
char verbose_str[128]; char verbose_str[128];
sprintf(verbose_str, "GC pause "); sprintf(verbose_str, "GC pause ");
if (g1_policy()->full_young_gcs()) { if (g1_policy()->gcs_are_young()) {
strcat(verbose_str, "(young)"); strcat(verbose_str, "(young)");
} else { } else {
strcat(verbose_str, "(partial)"); strcat(verbose_str, "(mixed)");
} }
if (g1_policy()->during_initial_mark_pause()) { if (g1_policy()->during_initial_mark_pause()) {
strcat(verbose_str, " (initial-mark)"); strcat(verbose_str, " (initial-mark)");
......
...@@ -50,7 +50,7 @@ static double cost_per_card_ms_defaults[] = { ...@@ -50,7 +50,7 @@ static double cost_per_card_ms_defaults[] = {
}; };
// all the same // all the same
static double fully_young_cards_per_entry_ratio_defaults[] = { static double young_cards_per_entry_ratio_defaults[] = {
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
}; };
...@@ -168,11 +168,10 @@ G1CollectorPolicy::G1CollectorPolicy() : ...@@ -168,11 +168,10 @@ G1CollectorPolicy::G1CollectorPolicy() :
_pending_card_diff_seq(new TruncatedSeq(TruncatedSeqLength)), _pending_card_diff_seq(new TruncatedSeq(TruncatedSeqLength)),
_rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)), _rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)),
_cost_per_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)), _cost_per_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_fully_young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)), _young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
_partially_young_cards_per_entry_ratio_seq( _mixed_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
new TruncatedSeq(TruncatedSeqLength)),
_cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)), _cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_partially_young_cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)), _mixed_cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)), _cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_cost_per_byte_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)), _cost_per_byte_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)),
_constant_other_time_ms_seq(new TruncatedSeq(TruncatedSeqLength)), _constant_other_time_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
...@@ -185,9 +184,9 @@ G1CollectorPolicy::G1CollectorPolicy() : ...@@ -185,9 +184,9 @@ G1CollectorPolicy::G1CollectorPolicy() :
_pause_time_target_ms((double) MaxGCPauseMillis), _pause_time_target_ms((double) MaxGCPauseMillis),
_full_young_gcs(true), _gcs_are_young(true),
_full_young_pause_num(0), _young_pause_num(0),
_partial_young_pause_num(0), _mixed_pause_num(0),
_during_marking(false), _during_marking(false),
_in_marking_window(false), _in_marking_window(false),
...@@ -198,7 +197,8 @@ G1CollectorPolicy::G1CollectorPolicy() : ...@@ -198,7 +197,8 @@ G1CollectorPolicy::G1CollectorPolicy() :
_young_gc_eff_seq(new TruncatedSeq(TruncatedSeqLength)), _young_gc_eff_seq(new TruncatedSeq(TruncatedSeqLength)),
_recent_prev_end_times_for_all_gcs_sec(new TruncatedSeq(NumPrevPausesForHeuristics)), _recent_prev_end_times_for_all_gcs_sec(
new TruncatedSeq(NumPrevPausesForHeuristics)),
_recent_avg_pause_time_ratio(0.0), _recent_avg_pause_time_ratio(0.0),
...@@ -206,8 +206,9 @@ G1CollectorPolicy::G1CollectorPolicy() : ...@@ -206,8 +206,9 @@ G1CollectorPolicy::G1CollectorPolicy() :
_initiate_conc_mark_if_possible(false), _initiate_conc_mark_if_possible(false),
_during_initial_mark_pause(false), _during_initial_mark_pause(false),
_should_revert_to_full_young_gcs(false), _should_revert_to_young_gcs(false),
_last_full_young_gc(false), _last_young_gc(false),
_last_gc_was_young(false),
_eden_bytes_before_gc(0), _eden_bytes_before_gc(0),
_survivor_bytes_before_gc(0), _survivor_bytes_before_gc(0),
...@@ -308,8 +309,8 @@ G1CollectorPolicy::G1CollectorPolicy() : ...@@ -308,8 +309,8 @@ G1CollectorPolicy::G1CollectorPolicy() :
_pending_card_diff_seq->add(0.0); _pending_card_diff_seq->add(0.0);
_rs_length_diff_seq->add(rs_length_diff_defaults[index]); _rs_length_diff_seq->add(rs_length_diff_defaults[index]);
_cost_per_card_ms_seq->add(cost_per_card_ms_defaults[index]); _cost_per_card_ms_seq->add(cost_per_card_ms_defaults[index]);
_fully_young_cards_per_entry_ratio_seq->add( _young_cards_per_entry_ratio_seq->add(
fully_young_cards_per_entry_ratio_defaults[index]); young_cards_per_entry_ratio_defaults[index]);
_cost_per_entry_ms_seq->add(cost_per_entry_ms_defaults[index]); _cost_per_entry_ms_seq->add(cost_per_entry_ms_defaults[index]);
_cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]); _cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]);
_constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]); _constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]);
...@@ -606,7 +607,7 @@ void G1CollectorPolicy::update_young_list_target_length(size_t rs_lengths) { ...@@ -606,7 +607,7 @@ void G1CollectorPolicy::update_young_list_target_length(size_t rs_lengths) {
size_t young_list_target_length = 0; size_t young_list_target_length = 0;
if (adaptive_young_list_length()) { if (adaptive_young_list_length()) {
if (full_young_gcs()) { if (gcs_are_young()) {
young_list_target_length = young_list_target_length =
calculate_young_list_target_length(rs_lengths, calculate_young_list_target_length(rs_lengths,
base_min_length, base_min_length,
...@@ -619,10 +620,10 @@ void G1CollectorPolicy::update_young_list_target_length(size_t rs_lengths) { ...@@ -619,10 +620,10 @@ void G1CollectorPolicy::update_young_list_target_length(size_t rs_lengths) {
// possible to maximize how many old regions we can add to it. // possible to maximize how many old regions we can add to it.
} }
} else { } else {
if (full_young_gcs()) { if (gcs_are_young()) {
young_list_target_length = _young_list_fixed_length; young_list_target_length = _young_list_fixed_length;
} else { } else {
// A bit arbitrary: during partially-young GCs we allocate half // A bit arbitrary: during mixed GCs we allocate half
// the young regions to try to add old regions to the CSet. // the young regions to try to add old regions to the CSet.
young_list_target_length = _young_list_fixed_length / 2; young_list_target_length = _young_list_fixed_length / 2;
// We choose to accept that we might go under the desired min // We choose to accept that we might go under the desired min
...@@ -655,7 +656,7 @@ G1CollectorPolicy::calculate_young_list_target_length(size_t rs_lengths, ...@@ -655,7 +656,7 @@ G1CollectorPolicy::calculate_young_list_target_length(size_t rs_lengths,
size_t desired_min_length, size_t desired_min_length,
size_t desired_max_length) { size_t desired_max_length) {
assert(adaptive_young_list_length(), "pre-condition"); assert(adaptive_young_list_length(), "pre-condition");
assert(full_young_gcs(), "only call this for fully-young GCs"); assert(gcs_are_young(), "only call this for young GCs");
// In case some edge-condition makes the desired max length too small... // In case some edge-condition makes the desired max length too small...
if (desired_max_length <= desired_min_length) { if (desired_max_length <= desired_min_length) {
...@@ -858,12 +859,11 @@ void G1CollectorPolicy::record_full_collection_end() { ...@@ -858,12 +859,11 @@ void G1CollectorPolicy::record_full_collection_end() {
_g1->clear_full_collection(); _g1->clear_full_collection();
// "Nuke" the heuristics that control the fully/partially young GC // "Nuke" the heuristics that control the young/mixed GC
// transitions and make sure we start with fully young GCs after the // transitions and make sure we start with young GCs after the Full GC.
// Full GC. set_gcs_are_young(true);
set_full_young_gcs(true); _last_young_gc = false;
_last_full_young_gc = false; _should_revert_to_young_gcs = false;
_should_revert_to_full_young_gcs = false;
clear_initiate_conc_mark_if_possible(); clear_initiate_conc_mark_if_possible();
clear_during_initial_mark_pause(); clear_during_initial_mark_pause();
_known_garbage_bytes = 0; _known_garbage_bytes = 0;
...@@ -892,7 +892,7 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec, ...@@ -892,7 +892,7 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec,
if (PrintGCDetails) { if (PrintGCDetails) {
gclog_or_tty->stamp(PrintGCTimeStamps); gclog_or_tty->stamp(PrintGCTimeStamps);
gclog_or_tty->print("[GC pause"); gclog_or_tty->print("[GC pause");
gclog_or_tty->print(" (%s)", full_young_gcs() ? "young" : "partial"); gclog_or_tty->print(" (%s)", gcs_are_young() ? "young" : "mixed");
} }
// We only need to do this here as the policy will only be applied // We only need to do this here as the policy will only be applied
...@@ -951,7 +951,7 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec, ...@@ -951,7 +951,7 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec,
// the evacuation pause if marking is in progress. // the evacuation pause if marking is in progress.
_cur_satb_drain_time_ms = 0.0; _cur_satb_drain_time_ms = 0.0;
_last_young_gc_full = false; _last_gc_was_young = false;
// do that for any other surv rate groups // do that for any other surv rate groups
_short_lived_surv_rate_group->stop_adding_regions(); _short_lived_surv_rate_group->stop_adding_regions();
...@@ -988,8 +988,8 @@ void G1CollectorPolicy::record_concurrent_mark_cleanup_start() { ...@@ -988,8 +988,8 @@ void G1CollectorPolicy::record_concurrent_mark_cleanup_start() {
} }
void G1CollectorPolicy::record_concurrent_mark_cleanup_completed() { void G1CollectorPolicy::record_concurrent_mark_cleanup_completed() {
_should_revert_to_full_young_gcs = false; _should_revert_to_young_gcs = false;
_last_full_young_gc = true; _last_young_gc = true;
_in_marking_window = false; _in_marking_window = false;
} }
...@@ -1153,7 +1153,7 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { ...@@ -1153,7 +1153,7 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
size_t marking_initiating_used_threshold = size_t marking_initiating_used_threshold =
(_g1->capacity() / 100) * InitiatingHeapOccupancyPercent; (_g1->capacity() / 100) * InitiatingHeapOccupancyPercent;
if (!_g1->mark_in_progress() && !_last_full_young_gc) { if (!_g1->mark_in_progress() && !_last_young_gc) {
assert(!last_pause_included_initial_mark, "invariant"); assert(!last_pause_included_initial_mark, "invariant");
if (cur_used_bytes > marking_initiating_used_threshold) { if (cur_used_bytes > marking_initiating_used_threshold) {
if (cur_used_bytes > _prev_collection_pause_used_at_end_bytes) { if (cur_used_bytes > _prev_collection_pause_used_at_end_bytes) {
...@@ -1458,57 +1458,57 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { ...@@ -1458,57 +1458,57 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
new_in_marking_window_im = true; new_in_marking_window_im = true;
} }
if (_last_full_young_gc) { if (_last_young_gc) {
if (!last_pause_included_initial_mark) { if (!last_pause_included_initial_mark) {
ergo_verbose2(ErgoPartiallyYoungGCs, ergo_verbose2(ErgoMixedGCs,
"start partially-young GCs", "start mixed GCs",
ergo_format_byte_perc("known garbage"), ergo_format_byte_perc("known garbage"),
_known_garbage_bytes, _known_garbage_ratio * 100.0); _known_garbage_bytes, _known_garbage_ratio * 100.0);
set_full_young_gcs(false); set_gcs_are_young(false);
} else { } else {
ergo_verbose0(ErgoPartiallyYoungGCs, ergo_verbose0(ErgoMixedGCs,
"do not start partially-young GCs", "do not start mixed GCs",
ergo_format_reason("concurrent cycle is about to start")); ergo_format_reason("concurrent cycle is about to start"));
} }
_last_full_young_gc = false; _last_young_gc = false;
} }
if ( !_last_young_gc_full ) { if (!_last_gc_was_young) {
if (_should_revert_to_full_young_gcs) { if (_should_revert_to_young_gcs) {
ergo_verbose2(ErgoPartiallyYoungGCs, ergo_verbose2(ErgoMixedGCs,
"end partially-young GCs", "end mixed GCs",
ergo_format_reason("partially-young GCs end requested") ergo_format_reason("mixed GCs end requested")
ergo_format_byte_perc("known garbage"), ergo_format_byte_perc("known garbage"),
_known_garbage_bytes, _known_garbage_ratio * 100.0); _known_garbage_bytes, _known_garbage_ratio * 100.0);
set_full_young_gcs(true); set_gcs_are_young(true);
} else if (_known_garbage_ratio < 0.05) { } else if (_known_garbage_ratio < 0.05) {
ergo_verbose3(ErgoPartiallyYoungGCs, ergo_verbose3(ErgoMixedGCs,
"end partially-young GCs", "end mixed GCs",
ergo_format_reason("known garbage percent lower than threshold") ergo_format_reason("known garbage percent lower than threshold")
ergo_format_byte_perc("known garbage") ergo_format_byte_perc("known garbage")
ergo_format_perc("threshold"), ergo_format_perc("threshold"),
_known_garbage_bytes, _known_garbage_ratio * 100.0, _known_garbage_bytes, _known_garbage_ratio * 100.0,
0.05 * 100.0); 0.05 * 100.0);
set_full_young_gcs(true); set_gcs_are_young(true);
} else if (adaptive_young_list_length() && } else if (adaptive_young_list_length() &&
(get_gc_eff_factor() * cur_efficiency < predict_young_gc_eff())) { (get_gc_eff_factor() * cur_efficiency < predict_young_gc_eff())) {
ergo_verbose5(ErgoPartiallyYoungGCs, ergo_verbose5(ErgoMixedGCs,
"end partially-young GCs", "end mixed GCs",
ergo_format_reason("current GC efficiency lower than " ergo_format_reason("current GC efficiency lower than "
"predicted fully-young GC efficiency") "predicted young GC efficiency")
ergo_format_double("GC efficiency factor") ergo_format_double("GC efficiency factor")
ergo_format_double("current GC efficiency") ergo_format_double("current GC efficiency")
ergo_format_double("predicted fully-young GC efficiency") ergo_format_double("predicted young GC efficiency")
ergo_format_byte_perc("known garbage"), ergo_format_byte_perc("known garbage"),
get_gc_eff_factor(), cur_efficiency, get_gc_eff_factor(), cur_efficiency,
predict_young_gc_eff(), predict_young_gc_eff(),
_known_garbage_bytes, _known_garbage_ratio * 100.0); _known_garbage_bytes, _known_garbage_ratio * 100.0);
set_full_young_gcs(true); set_gcs_are_young(true);
} }
} }
_should_revert_to_full_young_gcs = false; _should_revert_to_young_gcs = false;
if (_last_young_gc_full && !_during_marking) { if (_last_gc_was_young && !_during_marking) {
_young_gc_eff_seq->add(cur_efficiency); _young_gc_eff_seq->add(cur_efficiency);
} }
...@@ -1534,19 +1534,21 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { ...@@ -1534,19 +1534,21 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
double cost_per_entry_ms = 0.0; double cost_per_entry_ms = 0.0;
if (cards_scanned > 10) { if (cards_scanned > 10) {
cost_per_entry_ms = scan_rs_time / (double) cards_scanned; cost_per_entry_ms = scan_rs_time / (double) cards_scanned;
if (_last_young_gc_full) if (_last_gc_was_young) {
_cost_per_entry_ms_seq->add(cost_per_entry_ms); _cost_per_entry_ms_seq->add(cost_per_entry_ms);
else } else {
_partially_young_cost_per_entry_ms_seq->add(cost_per_entry_ms); _mixed_cost_per_entry_ms_seq->add(cost_per_entry_ms);
}
} }
if (_max_rs_lengths > 0) { if (_max_rs_lengths > 0) {
double cards_per_entry_ratio = double cards_per_entry_ratio =
(double) cards_scanned / (double) _max_rs_lengths; (double) cards_scanned / (double) _max_rs_lengths;
if (_last_young_gc_full) if (_last_gc_was_young) {
_fully_young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); _young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio);
else } else {
_partially_young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); _mixed_cards_per_entry_ratio_seq->add(cards_per_entry_ratio);
}
} }
// It turns out that, sometimes, _max_rs_lengths can get smaller // It turns out that, sometimes, _max_rs_lengths can get smaller
...@@ -1563,10 +1565,11 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { ...@@ -1563,10 +1565,11 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
double cost_per_byte_ms = 0.0; double cost_per_byte_ms = 0.0;
if (copied_bytes > 0) { if (copied_bytes > 0) {
cost_per_byte_ms = obj_copy_time / (double) copied_bytes; cost_per_byte_ms = obj_copy_time / (double) copied_bytes;
if (_in_marking_window) if (_in_marking_window) {
_cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms); _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms);
else } else {
_cost_per_byte_ms_seq->add(cost_per_byte_ms); _cost_per_byte_ms_seq->add(cost_per_byte_ms);
}
} }
double all_other_time_ms = pause_time_ms - double all_other_time_ms = pause_time_ms -
...@@ -1722,10 +1725,11 @@ predict_young_collection_elapsed_time_ms(size_t adjustment) { ...@@ -1722,10 +1725,11 @@ predict_young_collection_elapsed_time_ms(size_t adjustment) {
size_t rs_lengths = g1h->young_list()->sampled_rs_lengths() + size_t rs_lengths = g1h->young_list()->sampled_rs_lengths() +
predict_rs_length_diff(); predict_rs_length_diff();
size_t card_num; size_t card_num;
if (full_young_gcs()) if (gcs_are_young()) {
card_num = predict_young_card_num(rs_lengths); card_num = predict_young_card_num(rs_lengths);
else } else {
card_num = predict_non_young_card_num(rs_lengths); card_num = predict_non_young_card_num(rs_lengths);
}
size_t young_byte_size = young_num * HeapRegion::GrainBytes; size_t young_byte_size = young_num * HeapRegion::GrainBytes;
double accum_yg_surv_rate = double accum_yg_surv_rate =
_short_lived_surv_rate_group->accum_surv_rate(adjustment); _short_lived_surv_rate_group->accum_surv_rate(adjustment);
...@@ -1745,10 +1749,11 @@ double ...@@ -1745,10 +1749,11 @@ double
G1CollectorPolicy::predict_base_elapsed_time_ms(size_t pending_cards) { G1CollectorPolicy::predict_base_elapsed_time_ms(size_t pending_cards) {
size_t rs_length = predict_rs_length_diff(); size_t rs_length = predict_rs_length_diff();
size_t card_num; size_t card_num;
if (full_young_gcs()) if (gcs_are_young()) {
card_num = predict_young_card_num(rs_length); card_num = predict_young_card_num(rs_length);
else } else {
card_num = predict_non_young_card_num(rs_length); card_num = predict_non_young_card_num(rs_length);
}
return predict_base_elapsed_time_ms(pending_cards, card_num); return predict_base_elapsed_time_ms(pending_cards, card_num);
} }
...@@ -1766,10 +1771,11 @@ G1CollectorPolicy::predict_region_elapsed_time_ms(HeapRegion* hr, ...@@ -1766,10 +1771,11 @@ G1CollectorPolicy::predict_region_elapsed_time_ms(HeapRegion* hr,
bool young) { bool young) {
size_t rs_length = hr->rem_set()->occupied(); size_t rs_length = hr->rem_set()->occupied();
size_t card_num; size_t card_num;
if (full_young_gcs()) if (gcs_are_young()) {
card_num = predict_young_card_num(rs_length); card_num = predict_young_card_num(rs_length);
else } else {
card_num = predict_non_young_card_num(rs_length); card_num = predict_non_young_card_num(rs_length);
}
size_t bytes_to_copy = predict_bytes_to_copy(hr); size_t bytes_to_copy = predict_bytes_to_copy(hr);
double region_elapsed_time_ms = double region_elapsed_time_ms =
...@@ -1817,14 +1823,14 @@ void G1CollectorPolicy::check_if_region_is_too_expensive(double ...@@ -1817,14 +1823,14 @@ void G1CollectorPolicy::check_if_region_is_too_expensive(double
// I don't think we need to do this when in young GC mode since // I don't think we need to do this when in young GC mode since
// marking will be initiated next time we hit the soft limit anyway... // marking will be initiated next time we hit the soft limit anyway...
if (predicted_time_ms > _expensive_region_limit_ms) { if (predicted_time_ms > _expensive_region_limit_ms) {
ergo_verbose2(ErgoPartiallyYoungGCs, ergo_verbose2(ErgoMixedGCs,
"request partially-young GCs end", "request mixed GCs end",
ergo_format_reason("predicted region time higher than threshold") ergo_format_reason("predicted region time higher than threshold")
ergo_format_ms("predicted region time") ergo_format_ms("predicted region time")
ergo_format_ms("threshold"), ergo_format_ms("threshold"),
predicted_time_ms, _expensive_region_limit_ms); predicted_time_ms, _expensive_region_limit_ms);
// no point in doing another partial one // no point in doing another mixed GC
_should_revert_to_full_young_gcs = true; _should_revert_to_young_gcs = true;
} }
} }
...@@ -2033,8 +2039,8 @@ void G1CollectorPolicy::print_tracing_info() const { ...@@ -2033,8 +2039,8 @@ void G1CollectorPolicy::print_tracing_info() const {
print_summary_sd(0, "Total", _all_pause_times_ms); print_summary_sd(0, "Total", _all_pause_times_ms);
gclog_or_tty->print_cr(""); gclog_or_tty->print_cr("");
gclog_or_tty->print_cr(""); gclog_or_tty->print_cr("");
gclog_or_tty->print_cr(" Full Young GC Pauses: %8d", _full_young_pause_num); gclog_or_tty->print_cr(" Young GC Pauses: %8d", _young_pause_num);
gclog_or_tty->print_cr(" Partial Young GC Pauses: %8d", _partial_young_pause_num); gclog_or_tty->print_cr(" Mixed GC Pauses: %8d", _mixed_pause_num);
gclog_or_tty->print_cr(""); gclog_or_tty->print_cr("");
gclog_or_tty->print_cr("EVACUATION PAUSES"); gclog_or_tty->print_cr("EVACUATION PAUSES");
...@@ -2188,11 +2194,11 @@ G1CollectorPolicy::decide_on_conc_mark_initiation() { ...@@ -2188,11 +2194,11 @@ G1CollectorPolicy::decide_on_conc_mark_initiation() {
// initiate a new cycle. // initiate a new cycle.
set_during_initial_mark_pause(); set_during_initial_mark_pause();
// We do not allow non-full young GCs during marking. // We do not allow mixed GCs during marking.
if (!full_young_gcs()) { if (!gcs_are_young()) {
set_full_young_gcs(true); set_gcs_are_young(true);
ergo_verbose0(ErgoPartiallyYoungGCs, ergo_verbose0(ErgoMixedGCs,
"end partially-young GCs", "end mixed GCs",
ergo_format_reason("concurrent cycle is about to start")); ergo_format_reason("concurrent cycle is about to start"));
} }
...@@ -2623,12 +2629,12 @@ void G1CollectorPolicy::choose_collection_set(double target_pause_time_ms) { ...@@ -2623,12 +2629,12 @@ void G1CollectorPolicy::choose_collection_set(double target_pause_time_ms) {
double young_start_time_sec = os::elapsedTime(); double young_start_time_sec = os::elapsedTime();
_collection_set_bytes_used_before = 0; _collection_set_bytes_used_before = 0;
_last_young_gc_full = full_young_gcs() ? true : false; _last_gc_was_young = gcs_are_young() ? true : false;
if (_last_young_gc_full) { if (_last_gc_was_young) {
++_full_young_pause_num; ++_young_pause_num;
} else { } else {
++_partial_young_pause_num; ++_mixed_pause_num;
} }
// The young list is laid with the survivor regions from the previous // The young list is laid with the survivor regions from the previous
...@@ -2675,7 +2681,7 @@ void G1CollectorPolicy::choose_collection_set(double target_pause_time_ms) { ...@@ -2675,7 +2681,7 @@ void G1CollectorPolicy::choose_collection_set(double target_pause_time_ms) {
// We are doing young collections so reset this. // We are doing young collections so reset this.
non_young_start_time_sec = young_end_time_sec; non_young_start_time_sec = young_end_time_sec;
if (!full_young_gcs()) { if (!gcs_are_young()) {
bool should_continue = true; bool should_continue = true;
NumberSeq seq; NumberSeq seq;
double avg_prediction = 100000000000000000.0; // something very large double avg_prediction = 100000000000000000.0; // something very large
...@@ -2732,14 +2738,14 @@ void G1CollectorPolicy::choose_collection_set(double target_pause_time_ms) { ...@@ -2732,14 +2738,14 @@ void G1CollectorPolicy::choose_collection_set(double target_pause_time_ms) {
} while (should_continue); } while (should_continue);
if (!adaptive_young_list_length() && if (!adaptive_young_list_length() &&
cset_region_length() < _young_list_fixed_length) { cset_region_length() < _young_list_fixed_length) {
ergo_verbose2(ErgoCSetConstruction, ergo_verbose2(ErgoCSetConstruction,
"request partially-young GCs end", "request mixed GCs end",
ergo_format_reason("CSet length lower than target") ergo_format_reason("CSet length lower than target")
ergo_format_region("CSet") ergo_format_region("CSet")
ergo_format_region("young target"), ergo_format_region("young target"),
cset_region_length(), _young_list_fixed_length); cset_region_length(), _young_list_fixed_length);
_should_revert_to_full_young_gcs = true; _should_revert_to_young_gcs = true;
} }
ergo_verbose2(ErgoCSetConstruction | ErgoHigh, ergo_verbose2(ErgoCSetConstruction | ErgoHigh,
......
...@@ -164,8 +164,8 @@ private: ...@@ -164,8 +164,8 @@ private:
// times for a given worker thread. // times for a given worker thread.
double* _par_last_gc_worker_other_times_ms; double* _par_last_gc_worker_other_times_ms;
// indicates whether we are in full young or partially young GC mode // indicates whether we are in young or mixed GC mode
bool _full_young_gcs; bool _gcs_are_young;
// if true, then it tries to dynamically adjust the length of the // if true, then it tries to dynamically adjust the length of the
// young list // young list
...@@ -178,10 +178,10 @@ private: ...@@ -178,10 +178,10 @@ private:
// locker is active. This should be >= _young_list_target_length; // locker is active. This should be >= _young_list_target_length;
size_t _young_list_max_length; size_t _young_list_max_length;
bool _last_young_gc_full; bool _last_gc_was_young;
unsigned _full_young_pause_num; unsigned _young_pause_num;
unsigned _partial_young_pause_num; unsigned _mixed_pause_num;
bool _during_marking; bool _during_marking;
bool _in_marking_window; bool _in_marking_window;
...@@ -211,10 +211,10 @@ private: ...@@ -211,10 +211,10 @@ private:
TruncatedSeq* _pending_card_diff_seq; TruncatedSeq* _pending_card_diff_seq;
TruncatedSeq* _rs_length_diff_seq; TruncatedSeq* _rs_length_diff_seq;
TruncatedSeq* _cost_per_card_ms_seq; TruncatedSeq* _cost_per_card_ms_seq;
TruncatedSeq* _fully_young_cards_per_entry_ratio_seq; TruncatedSeq* _young_cards_per_entry_ratio_seq;
TruncatedSeq* _partially_young_cards_per_entry_ratio_seq; TruncatedSeq* _mixed_cards_per_entry_ratio_seq;
TruncatedSeq* _cost_per_entry_ms_seq; TruncatedSeq* _cost_per_entry_ms_seq;
TruncatedSeq* _partially_young_cost_per_entry_ms_seq; TruncatedSeq* _mixed_cost_per_entry_ms_seq;
TruncatedSeq* _cost_per_byte_ms_seq; TruncatedSeq* _cost_per_byte_ms_seq;
TruncatedSeq* _constant_other_time_ms_seq; TruncatedSeq* _constant_other_time_ms_seq;
TruncatedSeq* _young_other_cost_per_region_ms_seq; TruncatedSeq* _young_other_cost_per_region_ms_seq;
...@@ -322,20 +322,22 @@ public: ...@@ -322,20 +322,22 @@ public:
size_t predict_pending_card_diff() { size_t predict_pending_card_diff() {
double prediction = get_new_neg_prediction(_pending_card_diff_seq); double prediction = get_new_neg_prediction(_pending_card_diff_seq);
if (prediction < 0.00001) if (prediction < 0.00001) {
return 0; return 0;
else } else {
return (size_t) prediction; return (size_t) prediction;
}
} }
size_t predict_pending_cards() { size_t predict_pending_cards() {
size_t max_pending_card_num = _g1->max_pending_card_num(); size_t max_pending_card_num = _g1->max_pending_card_num();
size_t diff = predict_pending_card_diff(); size_t diff = predict_pending_card_diff();
size_t prediction; size_t prediction;
if (diff > max_pending_card_num) if (diff > max_pending_card_num) {
prediction = max_pending_card_num; prediction = max_pending_card_num;
else } else {
prediction = max_pending_card_num - diff; prediction = max_pending_card_num - diff;
}
return prediction; return prediction;
} }
...@@ -356,57 +358,62 @@ public: ...@@ -356,57 +358,62 @@ public:
return (double) pending_cards * predict_cost_per_card_ms(); return (double) pending_cards * predict_cost_per_card_ms();
} }
double predict_fully_young_cards_per_entry_ratio() { double predict_young_cards_per_entry_ratio() {
return get_new_prediction(_fully_young_cards_per_entry_ratio_seq); return get_new_prediction(_young_cards_per_entry_ratio_seq);
} }
double predict_partially_young_cards_per_entry_ratio() { double predict_mixed_cards_per_entry_ratio() {
if (_partially_young_cards_per_entry_ratio_seq->num() < 2) if (_mixed_cards_per_entry_ratio_seq->num() < 2) {
return predict_fully_young_cards_per_entry_ratio(); return predict_young_cards_per_entry_ratio();
else } else {
return get_new_prediction(_partially_young_cards_per_entry_ratio_seq); return get_new_prediction(_mixed_cards_per_entry_ratio_seq);
}
} }
size_t predict_young_card_num(size_t rs_length) { size_t predict_young_card_num(size_t rs_length) {
return (size_t) ((double) rs_length * return (size_t) ((double) rs_length *
predict_fully_young_cards_per_entry_ratio()); predict_young_cards_per_entry_ratio());
} }
size_t predict_non_young_card_num(size_t rs_length) { size_t predict_non_young_card_num(size_t rs_length) {
return (size_t) ((double) rs_length * return (size_t) ((double) rs_length *
predict_partially_young_cards_per_entry_ratio()); predict_mixed_cards_per_entry_ratio());
} }
double predict_rs_scan_time_ms(size_t card_num) { double predict_rs_scan_time_ms(size_t card_num) {
if (full_young_gcs()) if (gcs_are_young()) {
return (double) card_num * get_new_prediction(_cost_per_entry_ms_seq); return (double) card_num * get_new_prediction(_cost_per_entry_ms_seq);
else } else {
return predict_partially_young_rs_scan_time_ms(card_num); return predict_mixed_rs_scan_time_ms(card_num);
}
} }
double predict_partially_young_rs_scan_time_ms(size_t card_num) { double predict_mixed_rs_scan_time_ms(size_t card_num) {
if (_partially_young_cost_per_entry_ms_seq->num() < 3) if (_mixed_cost_per_entry_ms_seq->num() < 3) {
return (double) card_num * get_new_prediction(_cost_per_entry_ms_seq); return (double) card_num * get_new_prediction(_cost_per_entry_ms_seq);
else } else {
return (double) card_num * return (double) (card_num *
get_new_prediction(_partially_young_cost_per_entry_ms_seq); get_new_prediction(_mixed_cost_per_entry_ms_seq));
}
} }
double predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) { double predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) {
if (_cost_per_byte_ms_during_cm_seq->num() < 3) if (_cost_per_byte_ms_during_cm_seq->num() < 3) {
return 1.1 * (double) bytes_to_copy * return (1.1 * (double) bytes_to_copy) *
get_new_prediction(_cost_per_byte_ms_seq); get_new_prediction(_cost_per_byte_ms_seq);
else } else {
return (double) bytes_to_copy * return (double) bytes_to_copy *
get_new_prediction(_cost_per_byte_ms_during_cm_seq); get_new_prediction(_cost_per_byte_ms_during_cm_seq);
}
} }
double predict_object_copy_time_ms(size_t bytes_to_copy) { double predict_object_copy_time_ms(size_t bytes_to_copy) {
if (_in_marking_window && !_in_marking_window_im) if (_in_marking_window && !_in_marking_window_im) {
return predict_object_copy_time_ms_during_cm(bytes_to_copy); return predict_object_copy_time_ms_during_cm(bytes_to_copy);
else } else {
return (double) bytes_to_copy * return (double) bytes_to_copy *
get_new_prediction(_cost_per_byte_ms_seq); get_new_prediction(_cost_per_byte_ms_seq);
}
} }
double predict_constant_other_time_ms() { double predict_constant_other_time_ms() {
...@@ -414,15 +421,13 @@ public: ...@@ -414,15 +421,13 @@ public:
} }
double predict_young_other_time_ms(size_t young_num) { double predict_young_other_time_ms(size_t young_num) {
return return (double) young_num *
(double) young_num * get_new_prediction(_young_other_cost_per_region_ms_seq);
get_new_prediction(_young_other_cost_per_region_ms_seq);
} }
double predict_non_young_other_time_ms(size_t non_young_num) { double predict_non_young_other_time_ms(size_t non_young_num) {
return return (double) non_young_num *
(double) non_young_num * get_new_prediction(_non_young_other_cost_per_region_ms_seq);
get_new_prediction(_non_young_other_cost_per_region_ms_seq);
} }
void check_if_region_is_too_expensive(double predicted_time_ms); void check_if_region_is_too_expensive(double predicted_time_ms);
...@@ -456,7 +461,7 @@ public: ...@@ -456,7 +461,7 @@ public:
double predict_survivor_regions_evac_time(); double predict_survivor_regions_evac_time();
void cset_regions_freed() { void cset_regions_freed() {
bool propagate = _last_young_gc_full && !_in_marking_window; bool propagate = _last_gc_was_young && !_in_marking_window;
_short_lived_surv_rate_group->all_surviving_words_recorded(propagate); _short_lived_surv_rate_group->all_surviving_words_recorded(propagate);
_survivor_surv_rate_group->all_surviving_words_recorded(propagate); _survivor_surv_rate_group->all_surviving_words_recorded(propagate);
// also call it on any more surv rate groups // also call it on any more surv rate groups
...@@ -628,8 +633,8 @@ private: ...@@ -628,8 +633,8 @@ private:
// initial-mark work. // initial-mark work.
volatile bool _during_initial_mark_pause; volatile bool _during_initial_mark_pause;
bool _should_revert_to_full_young_gcs; bool _should_revert_to_young_gcs;
bool _last_full_young_gc; bool _last_young_gc;
// This set of variables tracks the collector efficiency, in order to // This set of variables tracks the collector efficiency, in order to
// determine whether we should initiate a new marking. // determine whether we should initiate a new marking.
...@@ -985,11 +990,11 @@ public: ...@@ -985,11 +990,11 @@ public:
return _young_list_max_length; return _young_list_max_length;
} }
bool full_young_gcs() { bool gcs_are_young() {
return _full_young_gcs; return _gcs_are_young;
} }
void set_full_young_gcs(bool full_young_gcs) { void set_gcs_are_young(bool gcs_are_young) {
_full_young_gcs = full_young_gcs; _gcs_are_young = gcs_are_young;
} }
bool adaptive_young_list_length() { bool adaptive_young_list_length() {
......
...@@ -52,14 +52,13 @@ void G1ErgoVerbose::set_enabled(bool enabled) { ...@@ -52,14 +52,13 @@ void G1ErgoVerbose::set_enabled(bool enabled) {
const char* G1ErgoVerbose::to_string(int tag) { const char* G1ErgoVerbose::to_string(int tag) {
ErgoHeuristic n = extract_heuristic(tag); ErgoHeuristic n = extract_heuristic(tag);
switch (n) { switch (n) {
case ErgoHeapSizing: return "Heap Sizing"; case ErgoHeapSizing: return "Heap Sizing";
case ErgoCSetConstruction: return "CSet Construction"; case ErgoCSetConstruction: return "CSet Construction";
case ErgoConcCycles: return "Concurrent Cycles"; case ErgoConcCycles: return "Concurrent Cycles";
case ErgoPartiallyYoungGCs: return "Partially-Young GCs"; case ErgoMixedGCs: return "Mixed GCs";
default: default:
ShouldNotReachHere(); ShouldNotReachHere();
// Keep the Windows compiler happy // Keep the Windows compiler happy
return NULL; return NULL;
} }
} }
...@@ -69,7 +69,7 @@ typedef enum { ...@@ -69,7 +69,7 @@ typedef enum {
ErgoHeapSizing = 0, ErgoHeapSizing = 0,
ErgoCSetConstruction, ErgoCSetConstruction,
ErgoConcCycles, ErgoConcCycles,
ErgoPartiallyYoungGCs, ErgoMixedGCs,
ErgoHeuristicNum ErgoHeuristicNum
} ErgoHeuristic; } ErgoHeuristic;
......
...@@ -119,7 +119,7 @@ class G1MonitoringSupport : public CHeapObj { ...@@ -119,7 +119,7 @@ class G1MonitoringSupport : public CHeapObj {
G1CollectedHeap* _g1h; G1CollectedHeap* _g1h;
// jstat performance counters // jstat performance counters
// incremental collections both fully and partially young // incremental collections both young and mixed
CollectorCounters* _incremental_collection_counters; CollectorCounters* _incremental_collection_counters;
// full stop-the-world collections // full stop-the-world collections
CollectorCounters* _full_collection_counters; CollectorCounters* _full_collection_counters;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册