8008301: G1: guarantee(satb_mq_set.completed_buffers_num() == 0) failure

Tue, 19 Mar 2013 09:38:37 -0700

author
johnc
date
Tue, 19 Mar 2013 09:38:37 -0700
changeset 4789
1179172e9ec9
parent 4788
e864cc14ca75
child 4790
7f0cb32dd233

8008301: G1: guarantee(satb_mq_set.completed_buffers_num() == 0) failure
Summary: If the marking stack overflows while the marking tasks are draining the SATB buffers, remark will exit with some SATB buffers left unprocessed. Relax the guarantee to allow for overflow.
Reviewed-by: jmasa, brutisso

src/share/vm/gc_implementation/g1/concurrentMark.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Tue Mar 19 00:57:39 2013 -0700
     1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Tue Mar 19 09:38:37 2013 -0700
     1.3 @@ -1289,12 +1289,22 @@
     1.4    if (has_overflown()) {
     1.5      // Oops.  We overflowed.  Restart concurrent marking.
     1.6      _restart_for_overflow = true;
     1.7 +    if (G1TraceMarkStackOverflow) {
     1.8 +      gclog_or_tty->print_cr("\nRemark led to restart for overflow.");
     1.9 +    }
    1.10 +
    1.11 +    // Verify the heap w.r.t. the previous marking bitmap.
    1.12 +    if (VerifyDuringGC) {
    1.13 +      HandleMark hm;  // handle scope
    1.14 +      gclog_or_tty->print(" VerifyDuringGC:(overflow)");
    1.15 +      Universe::heap()->prepare_for_verify();
    1.16 +      Universe::verify(/* silent */ false,
    1.17 +                       /* option */ VerifyOption_G1UsePrevMarking);
    1.18 +    }
    1.19 +
    1.20      // Clear the marking state because we will be restarting
    1.21      // marking due to overflowing the global mark stack.
    1.22      reset_marking_state();
    1.23 -    if (G1TraceMarkStackOverflow) {
    1.24 -      gclog_or_tty->print_cr("\nRemark led to restart for overflow.");
    1.25 -    }
    1.26    } else {
    1.27      // Aggregate the per-task counting data that we have accumulated
    1.28      // while marking.
    1.29 @@ -2593,7 +2603,11 @@
    1.30      remarkTask.work(0);
    1.31    }
    1.32    SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
    1.33 -  guarantee(satb_mq_set.completed_buffers_num() == 0, "invariant");
    1.34 +  guarantee(has_overflown() ||
    1.35 +            satb_mq_set.completed_buffers_num() == 0,
    1.36 +            err_msg("Invariant: has_overflown = %s, num buffers = %d",
    1.37 +                    BOOL_TO_STR(has_overflown()),
    1.38 +                    satb_mq_set.completed_buffers_num()));
    1.39  
    1.40    print_stats();
    1.41  }

mercurial