RFR: 8355756: G1HeapSizingPolicy::full_collection_resize_amount should consider allocation size [v2]
Thomas Schatzl
tschatzl at openjdk.org
Wed Apr 30 13:11:52 UTC 2025
On Wed, 30 Apr 2025 10:15:30 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:
>> Hi,
>>
>> Please review this change to account for pending allocations when deciding how much to shrink the heap after a full gc. Otherwise, we shrink the heap only to trigger an expansion to satisfy the allocation request that triggered the full gc.
>>
>> Testing: Tier 1-3
>
> Ivan Walulya has updated the pull request incrementally with one additional commit since the last revision:
>
> Thomas Review
Changes requested by tschatzl (Reviewer).
src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp line 242:
> 240: // Humongous objects are allocated in entire regions, we must calculate
> 241: // required space in terms of full regions, not just the object size.
> 242: allocation_word_size = align_up(allocation_word_size, G1HeapRegion::GrainWords);
Maybe it is worth adding a (static?) helper function for the padding to humongous object size because this would be the third time this is done in `G1CollectedHeap.cpp`.
Also I would prefer if the parts of the whole calculation were done before the actual sum in similar style to existing code:
I.e. something like:
if (_g1h->is_humongous(...)) {
allocation_word_size = _g1h->pad_to_humongous(...);
}
const size_t used_after_gc =
summand_1 +
summand_2 +
... +
allocation_word_size.
-------------
PR Review: https://git.openjdk.org/jdk/pull/24944#pullrequestreview-2807000400
PR Review Comment: https://git.openjdk.org/jdk/pull/24944#discussion_r2068631730
More information about the hotspot-gc-dev
mailing list