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

Print this page
rev 6670 : 8048085: Aborting marking just before remark results in useless additional clearing of the next mark bitmap
Summary: After concurrent mark abort due to Full GC G1 unnecessarily clears the next mark bitmap a second time concurrently. The Full GC mark abort procedure already did that. Before clearing the next mark bitmap, check whether mark abort occurred to avoid this work.
Reviewed-by: tbd
rev 6671 : imported patch bengt-fixes
rev 6672 : imported patch bengt-fixes2


 266         if (!cm()->has_aborted()) {
 267           g1_policy->record_concurrent_mark_cleanup_completed();
 268         }
 269       }
 270 
 271       if (cm()->has_aborted()) {
 272         if (G1Log::fine()) {
 273           gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id());
 274           gclog_or_tty->print_cr("[GC concurrent-mark-abort]");
 275         }
 276       }
 277 
 278       // We now want to allow clearing of the marking bitmap to be
 279       // suspended by a collection pause.
 280       // We may have aborted just before the remark. Do not bother clearing the
 281       // bitmap then, as it has been done during mark abort.
 282       if (!cm()->has_aborted()) {
 283         SuspendibleThreadSetJoiner sts;
 284         _cm->clearNextBitmap();
 285       } else {
 286         g1h->check_bitmaps("Reset bitmaps");
 287       }
 288     }
 289 
 290     // Update the number of full collections that have been
 291     // completed. This will also notify the FullGCCount_lock in case a
 292     // Java thread is waiting for a full GC to happen (e.g., it
 293     // called System.gc() with +ExplicitGCInvokesConcurrent).
 294     {
 295       SuspendibleThreadSetJoiner sts;
 296       g1h->increment_old_marking_cycles_completed(true /* concurrent */);
 297       g1h->register_concurrent_cycle_end();
 298     }
 299   }
 300   assert(_should_terminate, "just checking");
 301 
 302   terminate();
 303 }
 304 
 305 void ConcurrentMarkThread::stop() {
 306   {




 266         if (!cm()->has_aborted()) {
 267           g1_policy->record_concurrent_mark_cleanup_completed();
 268         }
 269       }
 270 
 271       if (cm()->has_aborted()) {
 272         if (G1Log::fine()) {
 273           gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id());
 274           gclog_or_tty->print_cr("[GC concurrent-mark-abort]");
 275         }
 276       }
 277 
 278       // We now want to allow clearing of the marking bitmap to be
 279       // suspended by a collection pause.
 280       // We may have aborted just before the remark. Do not bother clearing the
 281       // bitmap then, as it has been done during mark abort.
 282       if (!cm()->has_aborted()) {
 283         SuspendibleThreadSetJoiner sts;
 284         _cm->clearNextBitmap();
 285       } else {
 286         assert(!G1VerifyBitmaps || _cm->nextMarkBitmapIsClear(), "Next mark bitmap must be clear");
 287       }
 288     }
 289 
 290     // Update the number of full collections that have been
 291     // completed. This will also notify the FullGCCount_lock in case a
 292     // Java thread is waiting for a full GC to happen (e.g., it
 293     // called System.gc() with +ExplicitGCInvokesConcurrent).
 294     {
 295       SuspendibleThreadSetJoiner sts;
 296       g1h->increment_old_marking_cycles_completed(true /* concurrent */);
 297       g1h->register_concurrent_cycle_end();
 298     }
 299   }
 300   assert(_should_terminate, "just checking");
 301 
 302   terminate();
 303 }
 304 
 305 void ConcurrentMarkThread::stop() {
 306   {