RFR: 8344414: ZGC: Another division by zero in rule_major_allocation_rate
Erik Österlund
eosterlund at openjdk.org
Tue Nov 26 12:20:40 UTC 2024
On Tue, 19 Nov 2024 07:18:20 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
> This specific issue was known since #20888. As well as a more serious issue in `calculate_extra_young_gc_time` which may introduce a `NaN`. This specific issue is sane as long as we have IEEE 754 sans the C++ standard making division by zero UB.
>
> As discussed in #21304 it is probably better to try and tackle the division by zero issue by making sure the input is never zero. This patch introduces a small offset to the average which will effectively leave the value unchanged unless it is zero, and behave as almost zero in calculations without causing actual division by zero.
>
> There is still the issue with `NaN`, this patch adds a short circuit when this can occur and returns the analytical result of the calculation.
Looks good.
-------------
Marked as reviewed by eosterlund (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/22228#pullrequestreview-2461361841
More information about the hotspot-gc-dev
mailing list