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

Ivan Walulya iwalulya at openjdk.org
Mon Apr 24 08:34:47 UTC 2023


On Sun, 23 Apr 2023 01:01:53 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

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

Marked as reviewed by iwalulya (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/13601#pullrequestreview-1397448974


More information about the hotspot-gc-dev mailing list