RFR: 8285710: miscalculation of G1CardSetAllocator wasted memory size [v2]
tqxia
duke at openjdk.java.net
Fri May 6 06:58:14 UTC 2022
On Thu, 5 May 2022 13:29:51 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
>> tqxia has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit:
>>
>> 8285710: miscalculation of G1CardSetAllocator wasted memory size
>
> Hi @tqxia !
>
> after some internal discussion we found that the term "wasted" is too overloaded - it's typically used in gc for memory that is free but can't be used for some reason (which is in some cases arguable which is which). This is not the case here, the value returned by the `wasted_mem_size()` method is simply the amount of memory that is free for allocation in the remset data structure.
>
> Further, there is a problem in the documentation of `SegmentedArray::_num_available_slots` and `_num_allocated_slots` that might have led to this issue, and as far as we can tell also indicates that this change is incorrect too.
>
> So I filed a new issue https://bugs.openjdk.java.net/browse/JDK-8286189 that fixes that and I am going to post later. I recommend waiting just a bit for this simple rename.
Hi @tschatzl ,
Thanks for the review and update. Sure I will wait for JDK-8286189.
> I think the new calculation is wrong too. This is probably because of wrong documentation of `SegmentedArray::_num_available_slots` and `_num_allocated_slots`; in particular, `_num_allocated_slots` contains both free and pending counts.
>
> So the correct solution would be (a bit abbreviated) I think:
>
> ```
> unused_slots = (available - allocated) + _free_slots_list.free_count()
> ```
>
> The first term calculates the not yet used slots, and the second directly adds the free slots.
Thanks for the clarification. The new documentation on SegmentedArray::_num_available_slots and _num_allocated_slots makes sense to me.
Please correct me if I was wrong, so is the idea here to include free slots and exclude pending slots when counting unused slots?
-------------
PR: https://git.openjdk.java.net/jdk/pull/8424
More information about the hotspot-gc-dev
mailing list