8359868: Shenandoah: Free threshold heuristic does not use SoftMaxHeapSize

Reviewed-by: wkemper
This commit is contained in:
Rui Li 2025-07-08 21:58:22 +00:00 committed by William Kemper
parent 117f0b4051
commit 974ad4e8cd
4 changed files with 4 additions and 7 deletions

View File

@ -349,10 +349,7 @@ void ShenandoahAdaptiveHeuristics::adjust_spike_threshold(double amount) {
}
size_t ShenandoahAdaptiveHeuristics::min_free_threshold() {
// Note that soft_max_capacity() / 100 * min_free_threshold is smaller than max_capacity() / 100 * min_free_threshold.
// We want to behave conservatively here, so use max_capacity(). By returning a larger value, we cause the GC to
// trigger when the remaining amount of free shrinks below the larger threshold.
return _space_info->max_capacity() / 100 * ShenandoahMinFreeThreshold;
return ShenandoahHeap::heap()->soft_max_capacity() / 100 * ShenandoahMinFreeThreshold;
}
ShenandoahAllocationRate::ShenandoahAllocationRate() :

View File

@ -53,7 +53,7 @@ void ShenandoahGlobalHeuristics::choose_global_collection_set(ShenandoahCollecti
size_t cur_young_garbage) const {
auto heap = ShenandoahGenerationalHeap::heap();
size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes();
size_t capacity = heap->young_generation()->max_capacity();
size_t capacity = heap->soft_max_capacity();
size_t garbage_threshold = region_size_bytes * ShenandoahGarbageThreshold / 100;
size_t ignore_threshold = region_size_bytes * ShenandoahIgnoreGarbageThreshold / 100;
const uint tenuring_threshold = heap->age_census()->tenuring_threshold();

View File

@ -66,7 +66,7 @@ void ShenandoahYoungHeuristics::choose_young_collection_set(ShenandoahCollection
auto heap = ShenandoahGenerationalHeap::heap();
size_t capacity = heap->young_generation()->max_capacity();
size_t capacity = heap->soft_max_capacity();
size_t garbage_threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahGarbageThreshold / 100;
size_t ignore_threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahIgnoreGarbageThreshold / 100;
const uint tenuring_threshold = heap->age_census()->tenuring_threshold();

View File

@ -64,7 +64,7 @@ bool ShenandoahMetricsSnapshot::is_good_progress(ShenandoahGeneration* generatio
// ShenandoahCriticalFreeThreshold is expressed as a percentage. We multiple this percentage by 1/100th
// of the generation capacity to determine whether the available memory within the generation exceeds the
// critical threshold.
size_t free_expected = (generation->max_capacity() / 100) * ShenandoahCriticalFreeThreshold;
size_t free_expected = (ShenandoahHeap::heap()->soft_max_capacity() / 100) * ShenandoahCriticalFreeThreshold;
bool prog_free = free_actual >= free_expected;
log_info(gc, ergo)("%s progress for free space: %zu%s, need %zu%s",