6919638: CMS: ExplicitGCInvokesConcurrent misinteracts with gc locker

GC-locker induced concurrent full gc should be asynchronous; policy now controlled by a separate flag, which defaults to false.

Reviewed-by: jmasa
This commit is contained in:
Y. Srinivas Ramakrishna 2010-05-03 20:19:05 -07:00
parent 643553d0e6
commit d14cf2e13c
5 changed files with 14 additions and 9 deletions

View file

@ -1424,10 +1424,9 @@ bool ConcurrentMarkSweepGeneration::should_collect(bool full,
bool CMSCollector::shouldConcurrentCollect() {
if (_full_gc_requested) {
assert(ExplicitGCInvokesConcurrent, "Unexpected state");
if (Verbose && PrintGCDetails) {
gclog_or_tty->print_cr("CMSCollector: collect because of explicit "
" gc request");
" gc request (or gc_locker)");
}
return true;
}

View file

@ -163,6 +163,7 @@ void VM_CMS_Final_Remark::doit() {
// GenCollectedHeap heap.
void VM_GenCollectFullConcurrent::doit() {
assert(Thread::current()->is_VM_thread(), "Should be VM thread");
assert(GCLockerInvokesConcurrent || ExplicitGCInvokesConcurrent, "Unexpected");
GenCollectedHeap* gch = GenCollectedHeap::heap();
if (_gc_count_before == gch->total_collections()) {
@ -190,7 +191,7 @@ void VM_GenCollectFullConcurrent::doit() {
CMSCollector::disable_icms();
// In case CMS thread was in icms_wait(), wake it up.
CMSCollector::start_icms();
// Nudge the CMS thread to start a concurrent collection
// Nudge the CMS thread to start a concurrent collection.
CMSCollector::request_full_gc(_full_gc_count_before);
} else {
FullGCCount_lock->notify_all(); // Inform the Java thread its work is done
@ -231,7 +232,9 @@ void VM_GenCollectFullConcurrent::doit_epilogue() {
// e.g. at the rate of 1 full gc per ms, this could
// overflow in about 1000 years.
GenCollectedHeap* gch = GenCollectedHeap::heap();
if (gch->total_full_collections_completed() <= _full_gc_count_before) {
if (_gc_cause != GCCause::_gc_locker &&
gch->total_full_collections_completed() <= _full_gc_count_before) {
assert(ExplicitGCInvokesConcurrent, "Error");
// Now, wait for witnessing concurrent gc cycle to complete,
// but do so in native mode, because we want to lock the
// FullGCEvent_lock, which may be needed by the VM thread

View file

@ -126,8 +126,7 @@ class VM_GenCollectFullConcurrent: public VM_GC_Operation {
GCCause::Cause gc_cause)
: VM_GC_Operation(gc_count_before, full_gc_count_before, true /* full */) {
_gc_cause = gc_cause;
assert(FullGCCount_lock != NULL && UseConcMarkSweepGC &&
ExplicitGCInvokesConcurrent, "Otherwise shouldn't be here");
assert(FullGCCount_lock != NULL, "Error");
assert(UseAsyncConcMarkSweepGC, "Else will hang caller");
}
~VM_GenCollectFullConcurrent() {}