RFR: 8306695: Divide by zero in G1Policy::logged_cards_processing_time

Kim Barrett kbarrett at openjdk.org
Sun Apr 23 01:10:05 UTC 2023


Please review this change to G1Policy::logged_cards_processing_time to avoid a
floating point division by zero when both the number of logged cards and the
total cards processed are zero.  This happens during early GCs.  The fix is to
change the comparison used to decide between scaling the total time vs
ascribing all of the time to the logged cards.  It is changed from ">" to ">="
so that it also covers the case of both values being zero.

Testing:
mach5 tier1
Local build with UBSAN and verified there are no longer any division by zero
errors reported by it.

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

Commit messages:
 - fix

Changes: https://git.openjdk.org/jdk/pull/13601/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13601&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8306695
  Stats: 10 lines in 1 file changed: 7 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/13601.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13601/head:pull/13601

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


More information about the hotspot-gc-dev mailing list