RFR: 8285710: miscalculation of G1CardSetAllocator wasted memory size [v2]
Thomas Schatzl
tschatzl at openjdk.java.net
Fri May 6 09:41:41 UTC 2022
On Fri, 6 May 2022 08:58:29 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>>> Please correct me if I was wrong, so is the idea here to include free slots and exclude pending slots when counting unused slots?
>>
>> Yes. This has been a judgement call, there is no clear answer whether they should be counted as used or unused.
>>
>> The renaming change should be pushed by today.
>
>> is the idea here to include free slots and exclude pending slots when counting unused slots?
>
> I think not treating slots on pending lists as unused (or equivalently, treating slots on pending lists as "in-use") is cleaner. Since the free/pending counters are not strictly synchronized (`Atomic::add(&_free_count, count);` in `try_transfer_pending`), adding the pending counter in that formula could cause "unused slots > total slots", which is extremely confusing.
These statistics are calculated during safepoint/gc, so there can be no synchronization issues.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8424
More information about the hotspot-gc-dev
mailing list