src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp

Print this page
rev 4184 : 8004816: G1: Kitchensink failures after marking stack changes
Summary: Reset the marking state, including the mark stack overflow flag, in the event of a marking stack overflow during serial reference processing.
Reviewed-by: jmasa
   1 /*
   2  * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 140         _vtime_mark_accum += (mark_end_time - cycle_start);
 141         if (!cm()->has_aborted()) {
 142           if (g1_policy->adaptive_young_list_length()) {
 143             double now = os::elapsedTime();
 144             double remark_prediction_ms = g1_policy->predict_remark_time_ms();
 145             jlong sleep_time_ms = mmu_tracker->when_ms(now, remark_prediction_ms);
 146             os::sleep(current_thread, sleep_time_ms, false);
 147           }
 148 
 149           if (G1Log::fine()) {
 150             gclog_or_tty->date_stamp(PrintGCDateStamps);
 151             gclog_or_tty->stamp(PrintGCTimeStamps);
 152             gclog_or_tty->print_cr("[GC concurrent-mark-end, %1.7lf sec]",
 153                                       mark_end_sec - mark_start_sec);
 154           }
 155 
 156           CMCheckpointRootsFinalClosure final_cl(_cm);
 157           VM_CGC_Operation op(&final_cl, "GC remark", true /* needs_pll */);
 158           VMThread::execute(&op);
 159         }
 160         if (cm()->restart_for_overflow() &&
 161             G1TraceMarkStackOverflow) {
 162           gclog_or_tty->print_cr("Restarting conc marking because of MS overflow "
 163                                  "in remark (restart #%d).", iter);
 164         }
 165 
 166         if (cm()->restart_for_overflow()) {
 167           if (G1Log::fine()) {
 168             gclog_or_tty->date_stamp(PrintGCDateStamps);
 169             gclog_or_tty->stamp(PrintGCTimeStamps);
 170             gclog_or_tty->print_cr("[GC concurrent-mark-restart-for-overflow]");
 171           }
 172         }
 173       } while (cm()->restart_for_overflow());
 174 
 175       double end_time = os::elapsedVTime();
 176       // Update the total virtual time before doing this, since it will try
 177       // to measure it to get the vtime for this marking.  We purposely
 178       // neglect the presumably-short "completeCleanup" phase here.
 179       _vtime_accum = (end_time - _vtime_start);
 180 
 181       if (!cm()->has_aborted()) {
 182         if (g1_policy->adaptive_young_list_length()) {
 183           double now = os::elapsedTime();
 184           double cleanup_prediction_ms = g1_policy->predict_cleanup_time_ms();
 185           jlong sleep_time_ms = mmu_tracker->when_ms(now, cleanup_prediction_ms);
 186           os::sleep(current_thread, sleep_time_ms, false);


   1 /*
   2  * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 140         _vtime_mark_accum += (mark_end_time - cycle_start);
 141         if (!cm()->has_aborted()) {
 142           if (g1_policy->adaptive_young_list_length()) {
 143             double now = os::elapsedTime();
 144             double remark_prediction_ms = g1_policy->predict_remark_time_ms();
 145             jlong sleep_time_ms = mmu_tracker->when_ms(now, remark_prediction_ms);
 146             os::sleep(current_thread, sleep_time_ms, false);
 147           }
 148 
 149           if (G1Log::fine()) {
 150             gclog_or_tty->date_stamp(PrintGCDateStamps);
 151             gclog_or_tty->stamp(PrintGCTimeStamps);
 152             gclog_or_tty->print_cr("[GC concurrent-mark-end, %1.7lf sec]",
 153                                       mark_end_sec - mark_start_sec);
 154           }
 155 
 156           CMCheckpointRootsFinalClosure final_cl(_cm);
 157           VM_CGC_Operation op(&final_cl, "GC remark", true /* needs_pll */);
 158           VMThread::execute(&op);
 159         }
 160         if (cm()->restart_for_overflow()) {
 161           if (G1TraceMarkStackOverflow) {
 162             gclog_or_tty->print_cr("Restarting conc marking because of MS overflow "
 163                                    "in remark (restart #%d).", iter);
 164           }


 165           if (G1Log::fine()) {
 166             gclog_or_tty->date_stamp(PrintGCDateStamps);
 167             gclog_or_tty->stamp(PrintGCTimeStamps);
 168             gclog_or_tty->print_cr("[GC concurrent-mark-restart-for-overflow]");
 169           }
 170         }
 171       } while (cm()->restart_for_overflow());
 172 
 173       double end_time = os::elapsedVTime();
 174       // Update the total virtual time before doing this, since it will try
 175       // to measure it to get the vtime for this marking.  We purposely
 176       // neglect the presumably-short "completeCleanup" phase here.
 177       _vtime_accum = (end_time - _vtime_start);
 178 
 179       if (!cm()->has_aborted()) {
 180         if (g1_policy->adaptive_young_list_length()) {
 181           double now = os::elapsedTime();
 182           double cleanup_prediction_ms = g1_policy->predict_cleanup_time_ms();
 183           jlong sleep_time_ms = mmu_tracker->when_ms(now, cleanup_prediction_ms);
 184           os::sleep(current_thread, sleep_time_ms, false);