RFR: 8344414: ZGC: Another division by zero in rule_major_allocation_rate [v2]

Stefan Karlsson stefank at openjdk.org
Tue Dec 3 09:50:39 UTC 2024


On Mon, 2 Dec 2024 11:21:22 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.
>
> Axel Boldt-Christmas has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Always trigger OC, even when old_garbage is 0
>  - Merge tag 'jdk-24+26' into JDK-8344414
>    
>    Added tag jdk-24+26 for changeset 8485cb1c
>  - 8344414: ZGC: Another division by zero in rule_major_allocation_rate (ubsan)

Marked as reviewed by stefank (Reviewer).

-------------

PR Review: https://git.openjdk.org/jdk/pull/22228#pullrequestreview-2475122868


More information about the hotspot-gc-dev mailing list