8048085: Aborting marking just before remark results in useless additional clearing of the next mark bitmap

Mon, 21 Jul 2014 09:59:46 +0200

author
tschatzl
date
Mon, 21 Jul 2014 09:59:46 +0200
changeset 7016
3bf2fc51186b
parent 7015
4baf9bb2376c
child 7017
c512f38a5139

8048085: Aborting marking just before remark results in useless additional clearing of the next mark bitmap
Summary: Skip clearing the next bitmap if we just recently aborted since the full GC already clears this bitmap.
Reviewed-by: brutisso

src/share/vm/gc_implementation/g1/concurrentMark.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/concurrentMark.hpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Mon Jul 21 09:59:37 2014 +0200
     1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Mon Jul 21 09:59:46 2014 +0200
     1.3 @@ -890,6 +890,10 @@
     1.4    guarantee(!g1h->mark_in_progress(), "invariant");
     1.5  }
     1.6  
     1.7 +bool ConcurrentMark::nextMarkBitmapIsClear() {
     1.8 +  return _nextMarkBitMap->getNextMarkedWordAddress(_heap_start, _heap_end) == _heap_end;
     1.9 +}
    1.10 +
    1.11  class NoteStartOfMarkHRClosure: public HeapRegionClosure {
    1.12  public:
    1.13    bool doHeapRegion(HeapRegion* r) {
    1.14 @@ -3358,7 +3362,8 @@
    1.15  
    1.16  // abandon current marking iteration due to a Full GC
    1.17  void ConcurrentMark::abort() {
    1.18 -  // Clear all marks to force marking thread to do nothing
    1.19 +  // Clear all marks in the next bitmap for the next marking cycle. This will allow us to skip the next
    1.20 +  // concurrent bitmap clearing.
    1.21    _nextMarkBitMap->clearAll();
    1.22    // Clear the liveness counting data
    1.23    clear_all_count_data();
     2.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Mon Jul 21 09:59:37 2014 +0200
     2.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Mon Jul 21 09:59:46 2014 +0200
     2.3 @@ -736,6 +736,9 @@
     2.4    // Clear the next marking bitmap (will be called concurrently).
     2.5    void clearNextBitmap();
     2.6  
     2.7 +  // Return whether the next mark bitmap has no marks set.
     2.8 +  bool nextMarkBitmapIsClear();
     2.9 +
    2.10    // These two do the work that needs to be done before and after the
    2.11    // initial root checkpoint. Since this checkpoint can be done at two
    2.12    // different points (i.e. an explicit pause or piggy-backed on a
     3.1 --- a/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Mon Jul 21 09:59:37 2014 +0200
     3.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Mon Jul 21 09:59:46 2014 +0200
     3.3 @@ -275,9 +275,13 @@
     3.4  
     3.5        // We now want to allow clearing of the marking bitmap to be
     3.6        // suspended by a collection pause.
     3.7 -      {
     3.8 +      // We may have aborted just before the remark. Do not bother clearing the
     3.9 +      // bitmap then, as it has been done during mark abort.
    3.10 +      if (!cm()->has_aborted()) {
    3.11          SuspendibleThreadSetJoiner sts;
    3.12          _cm->clearNextBitmap();
    3.13 +      } else {
    3.14 +        assert(!G1VerifyBitmaps || _cm->nextMarkBitmapIsClear(), "Next mark bitmap must be clear");
    3.15        }
    3.16      }
    3.17  

mercurial