8058568: GC cleanup phase can cause G1 skipping a System.gc()
authorsjohanss
Mon, 20 Oct 2014 10:18:17 +0200
changeset 27250 cc55c7b61f08
parent 27249 698a2dc8e83a
child 27251 7d667f91ec8d
8058568: GC cleanup phase can cause G1 skipping a System.gc() Summary: Marking G1 FullGC as a _full collection and passing down the correct before count. Reviewed-by: brutisso, mgerdin
hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Aug 22 10:10:08 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Oct 20 10:18:17 2014 +0200
@@ -2483,6 +2483,7 @@
 
   unsigned int gc_count_before;
   unsigned int old_marking_count_before;
+  unsigned int full_gc_count_before;
   bool retry_gc;
 
   do {
@@ -2493,6 +2494,7 @@
 
       // Read the GC count while holding the Heap_lock
       gc_count_before = total_collections();
+      full_gc_count_before = total_full_collections();
       old_marking_count_before = _old_marking_cycles_started;
     }
 
@@ -2537,7 +2539,7 @@
         VMThread::execute(&op);
       } else {
         // Schedule a Full GC.
-        VM_G1CollectFull op(gc_count_before, old_marking_count_before, cause);
+        VM_G1CollectFull op(gc_count_before, full_gc_count_before, cause);
         VMThread::execute(&op);
       }
     }
--- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp	Fri Aug 22 10:10:08 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp	Mon Oct 20 10:18:17 2014 +0200
@@ -60,7 +60,7 @@
   VM_G1CollectFull(unsigned int gc_count_before,
                    unsigned int full_gc_count_before,
                    GCCause::Cause cause)
-    : VM_GC_Operation(gc_count_before, cause, full_gc_count_before) { }
+    : VM_GC_Operation(gc_count_before, cause, full_gc_count_before, true) { }
   virtual VMOp_Type type() const { return VMOp_G1CollectFull; }
   virtual void doit();
   virtual const char* name() const {