8355336: GenShen: Resume Old GC even with back-to-back Young GC triggers

Reviewed-by: wkemper
This commit is contained in:
Kelvin Nilsen 2025-04-27 20:10:20 +00:00
parent 9c86ac2723
commit cd6f0d19d5
3 changed files with 12 additions and 18 deletions

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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) {