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

Print this page
rev 2755 : 7099824: G1: we should take the pending list lock before doing the remark pause
Summary: Acquire the pending list lock in the prologue method of G1's
concurrent VM_Operation and release the lock in the epilogue() method.
The locking/unlocking order of the pending list lock and the Heap_lock
should match that in the prologue and epilogue methods of VM_GC_Operation.
Reviewed-by:

@@ -145,16 +145,12 @@
             gclog_or_tty->stamp(PrintGCTimeStamps);
             gclog_or_tty->print_cr("[GC concurrent-mark-restart-for-overflow]");
           }
         }
       } while (cm()->restart_for_overflow());
-      double counting_start_time = os::elapsedVTime();
-
-      // YSR: These look dubious (i.e. redundant) !!! FIX ME
-      slt()->manipulatePLL(SurrogateLockerThread::acquirePLL);
-      slt()->manipulatePLL(SurrogateLockerThread::releaseAndNotifyPLL);
 
+      double counting_start_time = os::elapsedVTime();
       if (!cm()->has_aborted()) {
         double count_start_sec = os::elapsedTime();
         if (PrintGC) {
           gclog_or_tty->date_stamp(PrintGCDateStamps);
           gclog_or_tty->stamp(PrintGCTimeStamps);

@@ -173,10 +169,11 @@
             gclog_or_tty->print_cr("[GC concurrent-count-end, %1.7lf]",
                                    count_end_sec - count_start_sec);
           }
         }
       }
+
       double end_time = os::elapsedVTime();
       _vtime_count_accum += (end_time - counting_start_time);
       // Update the total virtual time before doing this, since it will try
       // to measure it to get the vtime for this marking.  We purposely
       // neglect the presumably-short "completeCleanup" phase here.

@@ -333,15 +330,17 @@
   }
   set_in_progress();
   clear_started();
 }
 
-// Note: this method, although exported by the ConcurrentMarkSweepThread,
+// Note: this method, although exported by the ConcurrentMarkThread,
 // which is a non-JavaThread, can only be called by a JavaThread.
 // Currently this is done at vm creation time (post-vm-init) by the
 // main/Primordial (Java)Thread.
-// XXX Consider changing this in the future to allow the CMS thread
+// XXX Consider changing this in the future to allow the CM thread
 // itself to create this thread?
 void ConcurrentMarkThread::makeSurrogateLockerThread(TRAPS) {
+  assert(UseG1GC, "SLT thread needed only for concurrent GC");
+  assert(THREAD->is_Java_thread(), "must be a Java thread");
   assert(_slt == NULL, "SLT already created");
   _slt = SurrogateLockerThread::make(THREAD);
 }