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:

Split Close
Expand all
Collapse all
          --- old/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp
          +++ new/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp
↓ open down ↓ 85 lines elided ↑ open up ↑
  86   86                            double         target_pause_time_ms,
  87   87                            GCCause::Cause gc_cause);
  88   88    virtual VMOp_Type type() const { return VMOp_G1IncCollectionPause; }
  89   89    virtual void doit();
  90   90    virtual void doit_epilogue();
  91   91    virtual const char* name() const {
  92   92      return "garbage-first incremental collection pause";
  93   93    }
  94   94  };
  95   95  
  96      -// Concurrent GC stop-the-world operations such as initial and final mark;
       96 +// Concurrent GC stop-the-world operations such as final mark and cleanup;
  97   97  // consider sharing these with CMS's counterparts.
  98   98  class VM_CGC_Operation: public VM_Operation {
  99   99    VoidClosure* _cl;
 100  100    const char* _printGCMessage;
      101 +
      102 +protected:
      103 +  // java.lang.ref.Reference support
      104 +  void acquire_pending_list_lock();
      105 +  void release_and_notify_pending_list_lock();
      106 +  
 101  107  public:
 102  108    VM_CGC_Operation(VoidClosure* cl, const char *printGCMsg)
 103  109      : _cl(cl), _printGCMessage(printGCMsg) { }
 104  110    virtual VMOp_Type type() const { return VMOp_CGC_Operation; }
 105  111    virtual void doit();
 106  112    virtual bool doit_prologue();
 107  113    virtual void doit_epilogue();
 108  114    virtual const char* name() const {
 109  115      return "concurrent gc";
 110  116    }
 111  117  };
 112  118  
 113  119  #endif // SHARE_VM_GC_IMPLEMENTATION_G1_VM_OPERATIONS_G1_HPP
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX