diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index b71f058a82fc19be9873eb53f119c0d8fcd2ea60..801af4c0a463e08b3bb0915e21e8f2ffaf4a8d69 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -3365,6 +3365,14 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { // for the duration of this pause. g1_policy()->decide_on_conc_mark_initiation(); + // We do not allow initial-mark to be piggy-backed on a + // partially-young GC. + assert(!g1_policy()->during_initial_mark_pause() || + g1_policy()->full_young_gcs(), "sanity"); + + // We also do not allow partially-young GCs during marking. + assert(!mark_in_progress() || g1_policy()->full_young_gcs(), "sanity"); + char verbose_str[128]; sprintf(verbose_str, "GC pause "); if (g1_policy()->full_young_gcs()) { diff --git a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index 24f96aef85c5e95dd1ca2f3853c5f6d2b6ec4d55..ee3fc6ecac930782dca41a8e7a90f987c1bda595 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -1525,11 +1525,17 @@ void G1CollectorPolicy::record_collection_pause_end() { } if (_last_full_young_gc) { - ergo_verbose2(ErgoPartiallyYoungGCs, - "start partially-young GCs", - ergo_format_byte_perc("known garbage"), - _known_garbage_bytes, _known_garbage_ratio * 100.0); - set_full_young_gcs(false); + if (!last_pause_included_initial_mark) { + ergo_verbose2(ErgoPartiallyYoungGCs, + "start partially-young GCs", + ergo_format_byte_perc("known garbage"), + _known_garbage_bytes, _known_garbage_ratio * 100.0); + set_full_young_gcs(false); + } else { + ergo_verbose0(ErgoPartiallyYoungGCs, + "do not start partially-young GCs", + ergo_format_reason("concurrent cycle is about to start")); + } _last_full_young_gc = false; } @@ -2491,6 +2497,13 @@ G1CollectorPolicy::decide_on_conc_mark_initiation() { // initiate a new cycle. set_during_initial_mark_pause(); + // We do not allow non-full young GCs during marking. + if (!full_young_gcs()) { + set_full_young_gcs(true); + ergo_verbose0(ErgoPartiallyYoungGCs, + "end partially-young GCs", + ergo_format_reason("concurrent cycle is about to start")); + } // And we can now clear initiate_conc_mark_if_possible() as // we've already acted on it.