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

Kim Barrett kbarrett at openjdk.org
Tue Apr 25 04:25:33 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.

This pull request has now been integrated.

Changeset: 8063aa2e
Author:    Kim Barrett <kbarrett at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/8063aa2e4a71d3f9f7867563bae92a4f75097b2a
Stats:     10 lines in 1 file changed: 7 ins; 0 del; 3 mod

8306695: Divide by zero in G1Policy::logged_cards_processing_time

Reviewed-by: iwalulya, tschatzl

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

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


More information about the hotspot-gc-dev mailing list