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

Axel Boldt-Christmas aboldtch at openjdk.org
Mon Dec 2 11:21:22 UTC 2024


> 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)

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/22228/files
  - new: https://git.openjdk.org/jdk/pull/22228/files/3bc3ff4b..98c0acb8

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=22228&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=22228&range=00-01

  Stats: 54447 lines in 1247 files changed: 27258 ins; 21097 del; 6092 mod
  Patch: https://git.openjdk.org/jdk/pull/22228.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22228/head:pull/22228

PR: https://git.openjdk.org/jdk/pull/22228


More information about the hotspot-gc-dev mailing list