FullGC should not update accounting when release alloc regions

This commit is contained in:
Xiaolong Peng 2026-01-22 09:21:10 -08:00
parent f47d086ac4
commit 64ac804ded
4 changed files with 9 additions and 9 deletions

View File

@ -372,7 +372,7 @@ HeapWord* ShenandoahAllocator<ALLOC_PARTITION>::allocate(ShenandoahAllocRequest
}
template <ShenandoahFreeSetPartitionId ALLOC_PARTITION>
void ShenandoahAllocator<ALLOC_PARTITION>::release_alloc_regions() {
void ShenandoahAllocator<ALLOC_PARTITION>::release_alloc_regions(bool should_update_accounting) {
assert_at_safepoint();
shenandoah_assert_heaplocked();
@ -401,7 +401,7 @@ void ShenandoahAllocator<ALLOC_PARTITION>::release_alloc_regions() {
if (total_regions_to_unretire > 0) {
_free_set->partitions()->decrease_used(ALLOC_PARTITION, total_free_bytes);
_free_set->partitions()->increase_region_counts(ALLOC_PARTITION, total_regions_to_unretire);
accounting_updater._need_update = true;
accounting_updater._need_update = should_update_accounting;
}
}

View File

@ -141,7 +141,7 @@ public:
// Caller must hold the heap lock at safepoint. This causes all directly allocatable regions to be placed into
// the appropriate ShenandoahFreeSet partition.
// Collector calls this in preparation for choosing a collection set and/or rebuilding the freeset.
virtual void release_alloc_regions();
virtual void release_alloc_regions(bool should_update_accounting = true);
// Caller must hold the heap lock at safepoint. This causes us to set aside N regions as directly allocatable
// by removing these regions from the relevant ShenandoahFreeSet partitions.

View File

@ -851,15 +851,15 @@ public:
return _old_collector_allocator;
}
void release_alloc_regions() {
mutator_allocator()->release_alloc_regions();
collector_allocator()->release_alloc_regions();
void release_alloc_regions(bool should_update_accounting = true) {
mutator_allocator()->release_alloc_regions(should_update_accounting);
collector_allocator()->release_alloc_regions(should_update_accounting);
}
void release_alloc_regions_under_lock() {
void release_alloc_regions_under_lock(bool should_update_accounting = true) {
shenandoah_assert_not_heaplocked();
ShenandoahHeapLocker locker(_heap->lock());
release_alloc_regions();
release_alloc_regions(should_update_accounting);
}
// Handle allocation for collector (for evacuation).

View File

@ -217,7 +217,7 @@ void ShenandoahFullGC::do_it(GCCause::Cause gc_cause) {
heap->tlabs_retire(ResizeTLAB);
}
heap->free_set()->release_alloc_regions_under_lock();
heap->free_set()->release_alloc_regions_under_lock(false);
OrderAccess::fence();