comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @ 4710:41406797186b

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
author tonyp
date Fri, 16 Dec 2011 02:14:27 -0500
parents d23d2b18183e
children 67fdcb391461
comparison
equal deleted inserted replaced
4709:fd2b426c30db 4710:41406797186b
48 static double cost_per_card_ms_defaults[] = { 48 static double cost_per_card_ms_defaults[] = {
49 0.01, 0.005, 0.005, 0.003, 0.003, 0.002, 0.002, 0.0015 49 0.01, 0.005, 0.005, 0.003, 0.003, 0.002, 0.002, 0.0015
50 }; 50 };
51 51
52 // all the same 52 // all the same
53 static double fully_young_cards_per_entry_ratio_defaults[] = { 53 static double young_cards_per_entry_ratio_defaults[] = {
54 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 54 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
55 }; 55 };
56 56
57 static double cost_per_entry_ms_defaults[] = { 57 static double cost_per_entry_ms_defaults[] = {
58 0.015, 0.01, 0.01, 0.008, 0.008, 0.0055, 0.0055, 0.005 58 0.015, 0.01, 0.01, 0.008, 0.008, 0.0055, 0.0055, 0.005
166 _alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)), 166 _alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
167 _prev_collection_pause_end_ms(0.0), 167 _prev_collection_pause_end_ms(0.0),
168 _pending_card_diff_seq(new TruncatedSeq(TruncatedSeqLength)), 168 _pending_card_diff_seq(new TruncatedSeq(TruncatedSeqLength)),
169 _rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)), 169 _rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)),
170 _cost_per_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)), 170 _cost_per_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
171 _fully_young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)), 171 _young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
172 _partially_young_cards_per_entry_ratio_seq( 172 _mixed_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
173 new TruncatedSeq(TruncatedSeqLength)),
174 _cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)), 173 _cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
175 _partially_young_cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)), 174 _mixed_cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
176 _cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)), 175 _cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
177 _cost_per_byte_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)), 176 _cost_per_byte_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)),
178 _constant_other_time_ms_seq(new TruncatedSeq(TruncatedSeqLength)), 177 _constant_other_time_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
179 _young_other_cost_per_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)), 178 _young_other_cost_per_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
180 _non_young_other_cost_per_region_ms_seq( 179 _non_young_other_cost_per_region_ms_seq(
183 _pending_cards_seq(new TruncatedSeq(TruncatedSeqLength)), 182 _pending_cards_seq(new TruncatedSeq(TruncatedSeqLength)),
184 _rs_lengths_seq(new TruncatedSeq(TruncatedSeqLength)), 183 _rs_lengths_seq(new TruncatedSeq(TruncatedSeqLength)),
185 184
186 _pause_time_target_ms((double) MaxGCPauseMillis), 185 _pause_time_target_ms((double) MaxGCPauseMillis),
187 186
188 _full_young_gcs(true), 187 _gcs_are_young(true),
189 _full_young_pause_num(0), 188 _young_pause_num(0),
190 _partial_young_pause_num(0), 189 _mixed_pause_num(0),
191 190
192 _during_marking(false), 191 _during_marking(false),
193 _in_marking_window(false), 192 _in_marking_window(false),
194 _in_marking_window_im(false), 193 _in_marking_window_im(false),
195 194
196 _known_garbage_ratio(0.0), 195 _known_garbage_ratio(0.0),
197 _known_garbage_bytes(0), 196 _known_garbage_bytes(0),
198 197
199 _young_gc_eff_seq(new TruncatedSeq(TruncatedSeqLength)), 198 _young_gc_eff_seq(new TruncatedSeq(TruncatedSeqLength)),
200 199
201 _recent_prev_end_times_for_all_gcs_sec(new TruncatedSeq(NumPrevPausesForHeuristics)), 200 _recent_prev_end_times_for_all_gcs_sec(
201 new TruncatedSeq(NumPrevPausesForHeuristics)),
202 202
203 _recent_avg_pause_time_ratio(0.0), 203 _recent_avg_pause_time_ratio(0.0),
204 204
205 _all_full_gc_times_ms(new NumberSeq()), 205 _all_full_gc_times_ms(new NumberSeq()),
206 206
207 _initiate_conc_mark_if_possible(false), 207 _initiate_conc_mark_if_possible(false),
208 _during_initial_mark_pause(false), 208 _during_initial_mark_pause(false),
209 _should_revert_to_full_young_gcs(false), 209 _should_revert_to_young_gcs(false),
210 _last_full_young_gc(false), 210 _last_young_gc(false),
211 _last_gc_was_young(false),
211 212
212 _eden_bytes_before_gc(0), 213 _eden_bytes_before_gc(0),
213 _survivor_bytes_before_gc(0), 214 _survivor_bytes_before_gc(0),
214 _capacity_before_gc(0), 215 _capacity_before_gc(0),
215 216
306 index = ParallelGCThreads - 1; 307 index = ParallelGCThreads - 1;
307 308
308 _pending_card_diff_seq->add(0.0); 309 _pending_card_diff_seq->add(0.0);
309 _rs_length_diff_seq->add(rs_length_diff_defaults[index]); 310 _rs_length_diff_seq->add(rs_length_diff_defaults[index]);
310 _cost_per_card_ms_seq->add(cost_per_card_ms_defaults[index]); 311 _cost_per_card_ms_seq->add(cost_per_card_ms_defaults[index]);
311 _fully_young_cards_per_entry_ratio_seq->add( 312 _young_cards_per_entry_ratio_seq->add(
312 fully_young_cards_per_entry_ratio_defaults[index]); 313 young_cards_per_entry_ratio_defaults[index]);
313 _cost_per_entry_ms_seq->add(cost_per_entry_ms_defaults[index]); 314 _cost_per_entry_ms_seq->add(cost_per_entry_ms_defaults[index]);
314 _cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]); 315 _cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]);
315 _constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]); 316 _constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]);
316 _young_other_cost_per_region_ms_seq->add( 317 _young_other_cost_per_region_ms_seq->add(
317 young_other_cost_per_region_ms_defaults[index]); 318 young_other_cost_per_region_ms_defaults[index]);
604 desired_max_length = absolute_max_length; 605 desired_max_length = absolute_max_length;
605 } 606 }
606 607
607 size_t young_list_target_length = 0; 608 size_t young_list_target_length = 0;
608 if (adaptive_young_list_length()) { 609 if (adaptive_young_list_length()) {
609 if (full_young_gcs()) { 610 if (gcs_are_young()) {
610 young_list_target_length = 611 young_list_target_length =
611 calculate_young_list_target_length(rs_lengths, 612 calculate_young_list_target_length(rs_lengths,
612 base_min_length, 613 base_min_length,
613 desired_min_length, 614 desired_min_length,
614 desired_max_length); 615 desired_max_length);
617 // Don't calculate anything and let the code below bound it to 618 // Don't calculate anything and let the code below bound it to
618 // the desired_min_length, i.e., do the next GC as soon as 619 // the desired_min_length, i.e., do the next GC as soon as
619 // possible to maximize how many old regions we can add to it. 620 // possible to maximize how many old regions we can add to it.
620 } 621 }
621 } else { 622 } else {
622 if (full_young_gcs()) { 623 if (gcs_are_young()) {
623 young_list_target_length = _young_list_fixed_length; 624 young_list_target_length = _young_list_fixed_length;
624 } else { 625 } else {
625 // A bit arbitrary: during partially-young GCs we allocate half 626 // A bit arbitrary: during mixed GCs we allocate half
626 // the young regions to try to add old regions to the CSet. 627 // the young regions to try to add old regions to the CSet.
627 young_list_target_length = _young_list_fixed_length / 2; 628 young_list_target_length = _young_list_fixed_length / 2;
628 // We choose to accept that we might go under the desired min 629 // We choose to accept that we might go under the desired min
629 // length given that we intentionally ask for a smaller young gen. 630 // length given that we intentionally ask for a smaller young gen.
630 desired_min_length = absolute_min_length; 631 desired_min_length = absolute_min_length;
653 G1CollectorPolicy::calculate_young_list_target_length(size_t rs_lengths, 654 G1CollectorPolicy::calculate_young_list_target_length(size_t rs_lengths,
654 size_t base_min_length, 655 size_t base_min_length,
655 size_t desired_min_length, 656 size_t desired_min_length,
656 size_t desired_max_length) { 657 size_t desired_max_length) {
657 assert(adaptive_young_list_length(), "pre-condition"); 658 assert(adaptive_young_list_length(), "pre-condition");
658 assert(full_young_gcs(), "only call this for fully-young GCs"); 659 assert(gcs_are_young(), "only call this for young GCs");
659 660
660 // In case some edge-condition makes the desired max length too small... 661 // In case some edge-condition makes the desired max length too small...
661 if (desired_max_length <= desired_min_length) { 662 if (desired_max_length <= desired_min_length) {
662 return desired_min_length; 663 return desired_min_length;
663 } 664 }
856 857
857 update_recent_gc_times(end_sec, full_gc_time_ms); 858 update_recent_gc_times(end_sec, full_gc_time_ms);
858 859
859 _g1->clear_full_collection(); 860 _g1->clear_full_collection();
860 861
861 // "Nuke" the heuristics that control the fully/partially young GC 862 // "Nuke" the heuristics that control the young/mixed GC
862 // transitions and make sure we start with fully young GCs after the 863 // transitions and make sure we start with young GCs after the Full GC.
863 // Full GC. 864 set_gcs_are_young(true);
864 set_full_young_gcs(true); 865 _last_young_gc = false;
865 _last_full_young_gc = false; 866 _should_revert_to_young_gcs = false;
866 _should_revert_to_full_young_gcs = false;
867 clear_initiate_conc_mark_if_possible(); 867 clear_initiate_conc_mark_if_possible();
868 clear_during_initial_mark_pause(); 868 clear_during_initial_mark_pause();
869 _known_garbage_bytes = 0; 869 _known_garbage_bytes = 0;
870 _known_garbage_ratio = 0.0; 870 _known_garbage_ratio = 0.0;
871 _in_marking_window = false; 871 _in_marking_window = false;
890 void G1CollectorPolicy::record_collection_pause_start(double start_time_sec, 890 void G1CollectorPolicy::record_collection_pause_start(double start_time_sec,
891 size_t start_used) { 891 size_t start_used) {
892 if (PrintGCDetails) { 892 if (PrintGCDetails) {
893 gclog_or_tty->stamp(PrintGCTimeStamps); 893 gclog_or_tty->stamp(PrintGCTimeStamps);
894 gclog_or_tty->print("[GC pause"); 894 gclog_or_tty->print("[GC pause");
895 gclog_or_tty->print(" (%s)", full_young_gcs() ? "young" : "partial"); 895 gclog_or_tty->print(" (%s)", gcs_are_young() ? "young" : "mixed");
896 } 896 }
897 897
898 // We only need to do this here as the policy will only be applied 898 // We only need to do this here as the policy will only be applied
899 // to the GC we're about to start. so, no point is calculating this 899 // to the GC we're about to start. so, no point is calculating this
900 // every time we calculate / recalculate the target young length. 900 // every time we calculate / recalculate the target young length.
949 949
950 // This is initialized to zero here and is set during 950 // This is initialized to zero here and is set during
951 // the evacuation pause if marking is in progress. 951 // the evacuation pause if marking is in progress.
952 _cur_satb_drain_time_ms = 0.0; 952 _cur_satb_drain_time_ms = 0.0;
953 953
954 _last_young_gc_full = false; 954 _last_gc_was_young = false;
955 955
956 // do that for any other surv rate groups 956 // do that for any other surv rate groups
957 _short_lived_surv_rate_group->stop_adding_regions(); 957 _short_lived_surv_rate_group->stop_adding_regions();
958 _survivors_age_table.clear(); 958 _survivors_age_table.clear();
959 959
986 void G1CollectorPolicy::record_concurrent_mark_cleanup_start() { 986 void G1CollectorPolicy::record_concurrent_mark_cleanup_start() {
987 _mark_cleanup_start_sec = os::elapsedTime(); 987 _mark_cleanup_start_sec = os::elapsedTime();
988 } 988 }
989 989
990 void G1CollectorPolicy::record_concurrent_mark_cleanup_completed() { 990 void G1CollectorPolicy::record_concurrent_mark_cleanup_completed() {
991 _should_revert_to_full_young_gcs = false; 991 _should_revert_to_young_gcs = false;
992 _last_full_young_gc = true; 992 _last_young_gc = true;
993 _in_marking_window = false; 993 _in_marking_window = false;
994 } 994 }
995 995
996 void G1CollectorPolicy::record_concurrent_pause() { 996 void G1CollectorPolicy::record_concurrent_pause() {
997 if (_stop_world_start > 0.0) { 997 if (_stop_world_start > 0.0) {
1151 record_concurrent_mark_init_end(0.0); 1151 record_concurrent_mark_init_end(0.0);
1152 1152
1153 size_t marking_initiating_used_threshold = 1153 size_t marking_initiating_used_threshold =
1154 (_g1->capacity() / 100) * InitiatingHeapOccupancyPercent; 1154 (_g1->capacity() / 100) * InitiatingHeapOccupancyPercent;
1155 1155
1156 if (!_g1->mark_in_progress() && !_last_full_young_gc) { 1156 if (!_g1->mark_in_progress() && !_last_young_gc) {
1157 assert(!last_pause_included_initial_mark, "invariant"); 1157 assert(!last_pause_included_initial_mark, "invariant");
1158 if (cur_used_bytes > marking_initiating_used_threshold) { 1158 if (cur_used_bytes > marking_initiating_used_threshold) {
1159 if (cur_used_bytes > _prev_collection_pause_used_at_end_bytes) { 1159 if (cur_used_bytes > _prev_collection_pause_used_at_end_bytes) {
1160 assert(!during_initial_mark_pause(), "we should not see this here"); 1160 assert(!during_initial_mark_pause(), "we should not see this here");
1161 1161
1456 if (during_initial_mark_pause()) { 1456 if (during_initial_mark_pause()) {
1457 new_in_marking_window = true; 1457 new_in_marking_window = true;
1458 new_in_marking_window_im = true; 1458 new_in_marking_window_im = true;
1459 } 1459 }
1460 1460
1461 if (_last_full_young_gc) { 1461 if (_last_young_gc) {
1462 if (!last_pause_included_initial_mark) { 1462 if (!last_pause_included_initial_mark) {
1463 ergo_verbose2(ErgoPartiallyYoungGCs, 1463 ergo_verbose2(ErgoMixedGCs,
1464 "start partially-young GCs", 1464 "start mixed GCs",
1465 ergo_format_byte_perc("known garbage"), 1465 ergo_format_byte_perc("known garbage"),
1466 _known_garbage_bytes, _known_garbage_ratio * 100.0); 1466 _known_garbage_bytes, _known_garbage_ratio * 100.0);
1467 set_full_young_gcs(false); 1467 set_gcs_are_young(false);
1468 } else { 1468 } else {
1469 ergo_verbose0(ErgoPartiallyYoungGCs, 1469 ergo_verbose0(ErgoMixedGCs,
1470 "do not start partially-young GCs", 1470 "do not start mixed GCs",
1471 ergo_format_reason("concurrent cycle is about to start")); 1471 ergo_format_reason("concurrent cycle is about to start"));
1472 } 1472 }
1473 _last_full_young_gc = false; 1473 _last_young_gc = false;
1474 } 1474 }
1475 1475
1476 if ( !_last_young_gc_full ) { 1476 if (!_last_gc_was_young) {
1477 if (_should_revert_to_full_young_gcs) { 1477 if (_should_revert_to_young_gcs) {
1478 ergo_verbose2(ErgoPartiallyYoungGCs, 1478 ergo_verbose2(ErgoMixedGCs,
1479 "end partially-young GCs", 1479 "end mixed GCs",
1480 ergo_format_reason("partially-young GCs end requested") 1480 ergo_format_reason("mixed GCs end requested")
1481 ergo_format_byte_perc("known garbage"), 1481 ergo_format_byte_perc("known garbage"),
1482 _known_garbage_bytes, _known_garbage_ratio * 100.0); 1482 _known_garbage_bytes, _known_garbage_ratio * 100.0);
1483 set_full_young_gcs(true); 1483 set_gcs_are_young(true);
1484 } else if (_known_garbage_ratio < 0.05) { 1484 } else if (_known_garbage_ratio < 0.05) {
1485 ergo_verbose3(ErgoPartiallyYoungGCs, 1485 ergo_verbose3(ErgoMixedGCs,
1486 "end partially-young GCs", 1486 "end mixed GCs",
1487 ergo_format_reason("known garbage percent lower than threshold") 1487 ergo_format_reason("known garbage percent lower than threshold")
1488 ergo_format_byte_perc("known garbage") 1488 ergo_format_byte_perc("known garbage")
1489 ergo_format_perc("threshold"), 1489 ergo_format_perc("threshold"),
1490 _known_garbage_bytes, _known_garbage_ratio * 100.0, 1490 _known_garbage_bytes, _known_garbage_ratio * 100.0,
1491 0.05 * 100.0); 1491 0.05 * 100.0);
1492 set_full_young_gcs(true); 1492 set_gcs_are_young(true);
1493 } else if (adaptive_young_list_length() && 1493 } else if (adaptive_young_list_length() &&
1494 (get_gc_eff_factor() * cur_efficiency < predict_young_gc_eff())) { 1494 (get_gc_eff_factor() * cur_efficiency < predict_young_gc_eff())) {
1495 ergo_verbose5(ErgoPartiallyYoungGCs, 1495 ergo_verbose5(ErgoMixedGCs,
1496 "end partially-young GCs", 1496 "end mixed GCs",
1497 ergo_format_reason("current GC efficiency lower than " 1497 ergo_format_reason("current GC efficiency lower than "
1498 "predicted fully-young GC efficiency") 1498 "predicted young GC efficiency")
1499 ergo_format_double("GC efficiency factor") 1499 ergo_format_double("GC efficiency factor")
1500 ergo_format_double("current GC efficiency") 1500 ergo_format_double("current GC efficiency")
1501 ergo_format_double("predicted fully-young GC efficiency") 1501 ergo_format_double("predicted young GC efficiency")
1502 ergo_format_byte_perc("known garbage"), 1502 ergo_format_byte_perc("known garbage"),
1503 get_gc_eff_factor(), cur_efficiency, 1503 get_gc_eff_factor(), cur_efficiency,
1504 predict_young_gc_eff(), 1504 predict_young_gc_eff(),
1505 _known_garbage_bytes, _known_garbage_ratio * 100.0); 1505 _known_garbage_bytes, _known_garbage_ratio * 100.0);
1506 set_full_young_gcs(true); 1506 set_gcs_are_young(true);
1507 } 1507 }
1508 } 1508 }
1509 _should_revert_to_full_young_gcs = false; 1509 _should_revert_to_young_gcs = false;
1510 1510
1511 if (_last_young_gc_full && !_during_marking) { 1511 if (_last_gc_was_young && !_during_marking) {
1512 _young_gc_eff_seq->add(cur_efficiency); 1512 _young_gc_eff_seq->add(cur_efficiency);
1513 } 1513 }
1514 1514
1515 _short_lived_surv_rate_group->start_adding_regions(); 1515 _short_lived_surv_rate_group->start_adding_regions();
1516 // do that for any other surv rate groupsx 1516 // do that for any other surv rate groupsx
1532 size_t cards_scanned = _g1->cards_scanned(); 1532 size_t cards_scanned = _g1->cards_scanned();
1533 1533
1534 double cost_per_entry_ms = 0.0; 1534 double cost_per_entry_ms = 0.0;
1535 if (cards_scanned > 10) { 1535 if (cards_scanned > 10) {
1536 cost_per_entry_ms = scan_rs_time / (double) cards_scanned; 1536 cost_per_entry_ms = scan_rs_time / (double) cards_scanned;
1537 if (_last_young_gc_full) 1537 if (_last_gc_was_young) {
1538 _cost_per_entry_ms_seq->add(cost_per_entry_ms); 1538 _cost_per_entry_ms_seq->add(cost_per_entry_ms);
1539 else 1539 } else {
1540 _partially_young_cost_per_entry_ms_seq->add(cost_per_entry_ms); 1540 _mixed_cost_per_entry_ms_seq->add(cost_per_entry_ms);
1541 }
1541 } 1542 }
1542 1543
1543 if (_max_rs_lengths > 0) { 1544 if (_max_rs_lengths > 0) {
1544 double cards_per_entry_ratio = 1545 double cards_per_entry_ratio =
1545 (double) cards_scanned / (double) _max_rs_lengths; 1546 (double) cards_scanned / (double) _max_rs_lengths;
1546 if (_last_young_gc_full) 1547 if (_last_gc_was_young) {
1547 _fully_young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); 1548 _young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio);
1548 else 1549 } else {
1549 _partially_young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); 1550 _mixed_cards_per_entry_ratio_seq->add(cards_per_entry_ratio);
1551 }
1550 } 1552 }
1551 1553
1552 // It turns out that, sometimes, _max_rs_lengths can get smaller 1554 // It turns out that, sometimes, _max_rs_lengths can get smaller
1553 // than _recorded_rs_lengths which causes rs_length_diff to get 1555 // than _recorded_rs_lengths which causes rs_length_diff to get
1554 // very large and mess up the RSet length predictions. We'll be 1556 // very large and mess up the RSet length predictions. We'll be
1561 1563
1562 size_t copied_bytes = surviving_bytes; 1564 size_t copied_bytes = surviving_bytes;
1563 double cost_per_byte_ms = 0.0; 1565 double cost_per_byte_ms = 0.0;
1564 if (copied_bytes > 0) { 1566 if (copied_bytes > 0) {
1565 cost_per_byte_ms = obj_copy_time / (double) copied_bytes; 1567 cost_per_byte_ms = obj_copy_time / (double) copied_bytes;
1566 if (_in_marking_window) 1568 if (_in_marking_window) {
1567 _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms); 1569 _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms);
1568 else 1570 } else {
1569 _cost_per_byte_ms_seq->add(cost_per_byte_ms); 1571 _cost_per_byte_ms_seq->add(cost_per_byte_ms);
1572 }
1570 } 1573 }
1571 1574
1572 double all_other_time_ms = pause_time_ms - 1575 double all_other_time_ms = pause_time_ms -
1573 (update_rs_time + scan_rs_time + obj_copy_time + 1576 (update_rs_time + scan_rs_time + obj_copy_time +
1574 _mark_closure_time_ms + termination_time); 1577 _mark_closure_time_ms + termination_time);
1720 young_num += adjustment; 1723 young_num += adjustment;
1721 size_t pending_cards = predict_pending_cards(); 1724 size_t pending_cards = predict_pending_cards();
1722 size_t rs_lengths = g1h->young_list()->sampled_rs_lengths() + 1725 size_t rs_lengths = g1h->young_list()->sampled_rs_lengths() +
1723 predict_rs_length_diff(); 1726 predict_rs_length_diff();
1724 size_t card_num; 1727 size_t card_num;
1725 if (full_young_gcs()) 1728 if (gcs_are_young()) {
1726 card_num = predict_young_card_num(rs_lengths); 1729 card_num = predict_young_card_num(rs_lengths);
1727 else 1730 } else {
1728 card_num = predict_non_young_card_num(rs_lengths); 1731 card_num = predict_non_young_card_num(rs_lengths);
1732 }
1729 size_t young_byte_size = young_num * HeapRegion::GrainBytes; 1733 size_t young_byte_size = young_num * HeapRegion::GrainBytes;
1730 double accum_yg_surv_rate = 1734 double accum_yg_surv_rate =
1731 _short_lived_surv_rate_group->accum_surv_rate(adjustment); 1735 _short_lived_surv_rate_group->accum_surv_rate(adjustment);
1732 1736
1733 size_t bytes_to_copy = 1737 size_t bytes_to_copy =
1743 1747
1744 double 1748 double
1745 G1CollectorPolicy::predict_base_elapsed_time_ms(size_t pending_cards) { 1749 G1CollectorPolicy::predict_base_elapsed_time_ms(size_t pending_cards) {
1746 size_t rs_length = predict_rs_length_diff(); 1750 size_t rs_length = predict_rs_length_diff();
1747 size_t card_num; 1751 size_t card_num;
1748 if (full_young_gcs()) 1752 if (gcs_are_young()) {
1749 card_num = predict_young_card_num(rs_length); 1753 card_num = predict_young_card_num(rs_length);
1750 else 1754 } else {
1751 card_num = predict_non_young_card_num(rs_length); 1755 card_num = predict_non_young_card_num(rs_length);
1756 }
1752 return predict_base_elapsed_time_ms(pending_cards, card_num); 1757 return predict_base_elapsed_time_ms(pending_cards, card_num);
1753 } 1758 }
1754 1759
1755 double 1760 double
1756 G1CollectorPolicy::predict_base_elapsed_time_ms(size_t pending_cards, 1761 G1CollectorPolicy::predict_base_elapsed_time_ms(size_t pending_cards,
1764 double 1769 double
1765 G1CollectorPolicy::predict_region_elapsed_time_ms(HeapRegion* hr, 1770 G1CollectorPolicy::predict_region_elapsed_time_ms(HeapRegion* hr,
1766 bool young) { 1771 bool young) {
1767 size_t rs_length = hr->rem_set()->occupied(); 1772 size_t rs_length = hr->rem_set()->occupied();
1768 size_t card_num; 1773 size_t card_num;
1769 if (full_young_gcs()) 1774 if (gcs_are_young()) {
1770 card_num = predict_young_card_num(rs_length); 1775 card_num = predict_young_card_num(rs_length);
1771 else 1776 } else {
1772 card_num = predict_non_young_card_num(rs_length); 1777 card_num = predict_non_young_card_num(rs_length);
1778 }
1773 size_t bytes_to_copy = predict_bytes_to_copy(hr); 1779 size_t bytes_to_copy = predict_bytes_to_copy(hr);
1774 1780
1775 double region_elapsed_time_ms = 1781 double region_elapsed_time_ms =
1776 predict_rs_scan_time_ms(card_num) + 1782 predict_rs_scan_time_ms(card_num) +
1777 predict_object_copy_time_ms(bytes_to_copy); 1783 predict_object_copy_time_ms(bytes_to_copy);
1815 void G1CollectorPolicy::check_if_region_is_too_expensive(double 1821 void G1CollectorPolicy::check_if_region_is_too_expensive(double
1816 predicted_time_ms) { 1822 predicted_time_ms) {
1817 // I don't think we need to do this when in young GC mode since 1823 // I don't think we need to do this when in young GC mode since
1818 // marking will be initiated next time we hit the soft limit anyway... 1824 // marking will be initiated next time we hit the soft limit anyway...
1819 if (predicted_time_ms > _expensive_region_limit_ms) { 1825 if (predicted_time_ms > _expensive_region_limit_ms) {
1820 ergo_verbose2(ErgoPartiallyYoungGCs, 1826 ergo_verbose2(ErgoMixedGCs,
1821 "request partially-young GCs end", 1827 "request mixed GCs end",
1822 ergo_format_reason("predicted region time higher than threshold") 1828 ergo_format_reason("predicted region time higher than threshold")
1823 ergo_format_ms("predicted region time") 1829 ergo_format_ms("predicted region time")
1824 ergo_format_ms("threshold"), 1830 ergo_format_ms("threshold"),
1825 predicted_time_ms, _expensive_region_limit_ms); 1831 predicted_time_ms, _expensive_region_limit_ms);
1826 // no point in doing another partial one 1832 // no point in doing another mixed GC
1827 _should_revert_to_full_young_gcs = true; 1833 _should_revert_to_young_gcs = true;
1828 } 1834 }
1829 } 1835 }
1830 1836
1831 void G1CollectorPolicy::update_recent_gc_times(double end_time_sec, 1837 void G1CollectorPolicy::update_recent_gc_times(double end_time_sec,
1832 double elapsed_ms) { 1838 double elapsed_ms) {
2031 if (TraceGen0Time) { 2037 if (TraceGen0Time) {
2032 gclog_or_tty->print_cr("ALL PAUSES"); 2038 gclog_or_tty->print_cr("ALL PAUSES");
2033 print_summary_sd(0, "Total", _all_pause_times_ms); 2039 print_summary_sd(0, "Total", _all_pause_times_ms);
2034 gclog_or_tty->print_cr(""); 2040 gclog_or_tty->print_cr("");
2035 gclog_or_tty->print_cr(""); 2041 gclog_or_tty->print_cr("");
2036 gclog_or_tty->print_cr(" Full Young GC Pauses: %8d", _full_young_pause_num); 2042 gclog_or_tty->print_cr(" Young GC Pauses: %8d", _young_pause_num);
2037 gclog_or_tty->print_cr(" Partial Young GC Pauses: %8d", _partial_young_pause_num); 2043 gclog_or_tty->print_cr(" Mixed GC Pauses: %8d", _mixed_pause_num);
2038 gclog_or_tty->print_cr(""); 2044 gclog_or_tty->print_cr("");
2039 2045
2040 gclog_or_tty->print_cr("EVACUATION PAUSES"); 2046 gclog_or_tty->print_cr("EVACUATION PAUSES");
2041 print_summary(_summary); 2047 print_summary(_summary);
2042 2048
2186 // The concurrent marking thread is not "during a cycle", i.e., 2192 // The concurrent marking thread is not "during a cycle", i.e.,
2187 // it has completed the last one. So we can go ahead and 2193 // it has completed the last one. So we can go ahead and
2188 // initiate a new cycle. 2194 // initiate a new cycle.
2189 2195
2190 set_during_initial_mark_pause(); 2196 set_during_initial_mark_pause();
2191 // We do not allow non-full young GCs during marking. 2197 // We do not allow mixed GCs during marking.
2192 if (!full_young_gcs()) { 2198 if (!gcs_are_young()) {
2193 set_full_young_gcs(true); 2199 set_gcs_are_young(true);
2194 ergo_verbose0(ErgoPartiallyYoungGCs, 2200 ergo_verbose0(ErgoMixedGCs,
2195 "end partially-young GCs", 2201 "end mixed GCs",
2196 ergo_format_reason("concurrent cycle is about to start")); 2202 ergo_format_reason("concurrent cycle is about to start"));
2197 } 2203 }
2198 2204
2199 // And we can now clear initiate_conc_mark_if_possible() as 2205 // And we can now clear initiate_conc_mark_if_possible() as
2200 // we've already acted on it. 2206 // we've already acted on it.
2621 2627
2622 HeapRegion* hr; 2628 HeapRegion* hr;
2623 double young_start_time_sec = os::elapsedTime(); 2629 double young_start_time_sec = os::elapsedTime();
2624 2630
2625 _collection_set_bytes_used_before = 0; 2631 _collection_set_bytes_used_before = 0;
2626 _last_young_gc_full = full_young_gcs() ? true : false; 2632 _last_gc_was_young = gcs_are_young() ? true : false;
2627 2633
2628 if (_last_young_gc_full) { 2634 if (_last_gc_was_young) {
2629 ++_full_young_pause_num; 2635 ++_young_pause_num;
2630 } else { 2636 } else {
2631 ++_partial_young_pause_num; 2637 ++_mixed_pause_num;
2632 } 2638 }
2633 2639
2634 // The young list is laid with the survivor regions from the previous 2640 // The young list is laid with the survivor regions from the previous
2635 // pause are appended to the RHS of the young list, i.e. 2641 // pause are appended to the RHS of the young list, i.e.
2636 // [Newly Young Regions ++ Survivors from last pause]. 2642 // [Newly Young Regions ++ Survivors from last pause].
2673 (young_end_time_sec - young_start_time_sec) * 1000.0; 2679 (young_end_time_sec - young_start_time_sec) * 1000.0;
2674 2680
2675 // We are doing young collections so reset this. 2681 // We are doing young collections so reset this.
2676 non_young_start_time_sec = young_end_time_sec; 2682 non_young_start_time_sec = young_end_time_sec;
2677 2683
2678 if (!full_young_gcs()) { 2684 if (!gcs_are_young()) {
2679 bool should_continue = true; 2685 bool should_continue = true;
2680 NumberSeq seq; 2686 NumberSeq seq;
2681 double avg_prediction = 100000000000000000.0; // something very large 2687 double avg_prediction = 100000000000000000.0; // something very large
2682 2688
2683 double prev_predicted_pause_time_ms = predicted_pause_time_ms; 2689 double prev_predicted_pause_time_ms = predicted_pause_time_ms;
2730 } 2736 }
2731 } 2737 }
2732 } while (should_continue); 2738 } while (should_continue);
2733 2739
2734 if (!adaptive_young_list_length() && 2740 if (!adaptive_young_list_length() &&
2735 cset_region_length() < _young_list_fixed_length) { 2741 cset_region_length() < _young_list_fixed_length) {
2736 ergo_verbose2(ErgoCSetConstruction, 2742 ergo_verbose2(ErgoCSetConstruction,
2737 "request partially-young GCs end", 2743 "request mixed GCs end",
2738 ergo_format_reason("CSet length lower than target") 2744 ergo_format_reason("CSet length lower than target")
2739 ergo_format_region("CSet") 2745 ergo_format_region("CSet")
2740 ergo_format_region("young target"), 2746 ergo_format_region("young target"),
2741 cset_region_length(), _young_list_fixed_length); 2747 cset_region_length(), _young_list_fixed_length);
2742 _should_revert_to_full_young_gcs = true; 2748 _should_revert_to_young_gcs = true;
2743 } 2749 }
2744 2750
2745 ergo_verbose2(ErgoCSetConstruction | ErgoHigh, 2751 ergo_verbose2(ErgoCSetConstruction | ErgoHigh,
2746 "add old regions to CSet", 2752 "add old regions to CSet",
2747 ergo_format_region("old") 2753 ergo_format_region("old")