6983311: G1: LoopTest hangs when run with -XX:+ExplicitInvokesConcurrent

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
This commit is contained in:
John Cuthbertson 2010-10-01 18:23:16 -07:00
parent 603e50f355
commit 20289fbffd
3 changed files with 14 additions and 5 deletions

View file

@ -1785,6 +1785,14 @@ void G1CollectedHeap::increment_full_collections_completed(bool outer) {
_full_collections_completed += 1;
// We need to clear the "in_progress" flag in the CM thread before
// we wake up any waiters (especially when ExplicitInvokesConcurrent
// is set) so that if a waiter requests another System.gc() it doesn't
// incorrectly see that a marking cyle is still in progress.
if (outer) {
_cmThread->clear_in_progress();
}
// This notify_all() will ensure that a thread that called
// System.gc() with (with ExplicitGCInvokesConcurrent set or not)
// and it's waiting for a full GC to finish will be woken up. It is