RFR: 8365656: [ubsan] G1CSetCandidateGroup::liveness() reports division by 0 [v2]
Thomas Schatzl
tschatzl at openjdk.org
Fri Aug 22 10:28:52 UTC 2025
On Fri, 22 Aug 2025 10:18:56 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
>> src/hotspot/share/gc/g1/g1ConcurrentMark.cpp line 3165:
>>
>>> 3163: G1CollectedHeap* g1h = G1CollectedHeap::heap();
>>> 3164:
>>> 3165: if (g1h->young_regions_cset_group()->length() != 0) {
>>
>> Would it make sense to have this check inside `log_cset_candidate_group_add_total` instead?
>
> Actually this hunk has been committed wrongly, as I did some testing, but thanks for the discussion:
>
> I am fairly unsure where to best put that check
>
> - for a card group with a length of 0 the liveness does not make sense, but since it is that special young card group does exist and always takes some memory, printing it is useful.
>
> We want its memory usage to show up in the total memory consumption too.
>
> Adding this check in `log_cset_candidate_group_add_total` to (as far as I can guess from your suggestion) just not print the log line for this is also confusing: total memory consumption will be != 0, but no separate line for that card group printed...
>
> - So the initial change that @walulyai did not like put that check into the argument of the log processing, so it would print the line, and we would have an assert in `liveness_percent()` to not try to get that value for such card groups otherwise.
>
> Thoughts?
since it's "just" logging anyway @walulyai's suggestion is maybe easiest and acceptable
.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26888#discussion_r2293350379
More information about the hotspot-gc-dev
mailing list