diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp index cf1a76ff4ff..2d0bbfd5e4a 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp @@ -639,12 +639,9 @@ bool ShenandoahOldHeuristics::should_resume_old_cycle() { bool ShenandoahOldHeuristics::should_start_gc() { const ShenandoahHeap* heap = ShenandoahHeap::heap(); - if (_old_generation->is_doing_mixed_evacuations()) { - // Do not try to start an old cycle if we are waiting for old regions to be evacuated (we need - // a young cycle for this). Note that the young heuristic has a feature to expedite old evacuations. - // Future refinement: under certain circumstances, we might be more sophisticated about this choice. - // For example, we could choose to abandon the previous old collection before it has completed evacuations. - log_debug(gc)("Not starting an old cycle because we are waiting for mixed evacuations"); + if (!_old_generation->is_idle()) { + // Do not try to start an old cycle if old-gen is marking, doing mixed evacuations, or coalescing and filling. + log_debug(gc)("Not starting an old cycle because old gen is busy"); return false; } diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp index ba09eeb8794..3aca436104b 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp @@ -120,6 +120,7 @@ bool ShenandoahYoungHeuristics::should_start_gc() { if (old_time_elapsed < ShenandoahMinimumOldTimeMs) { // Do not decline_trigger() when waiting for minimum quantum of Old-gen marking. It is not at our discretion // to trigger at this time. + log_debug(gc)("Young heuristics declines to trigger because old_time_elapsed < ShenandoahMinimumOldTimeMs"); return false; } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahRegulatorThread.cpp b/src/hotspot/share/gc/shenandoah/shenandoahRegulatorThread.cpp index bf309af9743..774c4f7d941 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahRegulatorThread.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahRegulatorThread.cpp @@ -67,22 +67,18 @@ void ShenandoahRegulatorThread::regulate_young_and_old_cycles() { _global_heuristics->cancel_trigger_request(); } } else { - if (_young_heuristics->should_start_gc()) { - // Give the old generation a chance to run. The old generation cycle - // begins with a 'bootstrap' cycle that will also collect young. - if (start_old_cycle()) { - log_debug(gc)("Heuristics request for old collection accepted"); - _young_heuristics->cancel_trigger_request(); - _old_heuristics->cancel_trigger_request(); - } else if (request_concurrent_gc(_heap->young_generation())) { - log_debug(gc)("Heuristics request for young collection accepted"); - _young_heuristics->cancel_trigger_request(); - } - } else if (_old_heuristics->should_resume_old_cycle() || _old_heuristics->should_start_gc()) { + if (_old_heuristics->should_resume_old_cycle()) { if (request_concurrent_gc(_heap->old_generation())) { _old_heuristics->cancel_trigger_request(); log_debug(gc)("Heuristics request to resume old collection accepted"); } + } else if (start_old_cycle()) { + log_debug(gc)("Heuristics request for old collection accepted"); + _young_heuristics->cancel_trigger_request(); + _old_heuristics->cancel_trigger_request(); + } else if (start_young_cycle()) { + log_debug(gc)("Heuristics request for young collection accepted"); + _young_heuristics->cancel_trigger_request(); } } } else if (mode == ShenandoahGenerationalControlThread::servicing_old) {