comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 1840:4e0094bc41fa

6983311: G1: LoopTest hangs when run with -XX:+ExplicitInvokesConcurrent Summary: Clear the concurrent marking "in progress" flag while the FullGCCount_lock is held. This avoids a race that can cause back to back System.gc() calls, when ExplicitGCInvokesConcurrent is enabled, to fail to initiate a marking cycle causing the requesting thread to hang. Reviewed-by: tonyp, ysr
author johnc
date Fri, 01 Oct 2010 18:23:16 -0700
parents 8b10f48633dc
children c32059ef4dc0
comparison
equal deleted inserted replaced
1838:8f6f7587d292 1840:4e0094bc41fa
1782 err_msg("for outer caller: full_collections_started = %u " 1782 err_msg("for outer caller: full_collections_started = %u "
1783 "is inconsistent with _full_collections_completed = %u", 1783 "is inconsistent with _full_collections_completed = %u",
1784 full_collections_started, _full_collections_completed)); 1784 full_collections_started, _full_collections_completed));
1785 1785
1786 _full_collections_completed += 1; 1786 _full_collections_completed += 1;
1787
1788 // We need to clear the "in_progress" flag in the CM thread before
1789 // we wake up any waiters (especially when ExplicitInvokesConcurrent
1790 // is set) so that if a waiter requests another System.gc() it doesn't
1791 // incorrectly see that a marking cyle is still in progress.
1792 if (outer) {
1793 _cmThread->clear_in_progress();
1794 }
1787 1795
1788 // This notify_all() will ensure that a thread that called 1796 // This notify_all() will ensure that a thread that called
1789 // System.gc() with (with ExplicitGCInvokesConcurrent set or not) 1797 // System.gc() with (with ExplicitGCInvokesConcurrent set or not)
1790 // and it's waiting for a full GC to finish will be woken up. It is 1798 // and it's waiting for a full GC to finish will be woken up. It is
1791 // waiting in VM_G1IncCollectionPause::doit_epilogue(). 1799 // waiting in VM_G1IncCollectionPause::doit_epilogue().