RFR: 8295267: Improve G1 merge to scan ratio calculation

Albert Mingkun Yang ayang at openjdk.org
Thu Oct 13 13:01:14 UTC 2022


On Thu, 13 Oct 2022 11:57:21 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> Hi all,
> 
>   can I have reviews for this change that fixes the merge-to-scan ratio calculation ("which fraction of the remembered sets creates unique cards") for predictions to make it more accurate and understandable?
> 
> Previously the denominator has been the total number of scanned cards; this seems to be a good approximation (trying to make a case for it, it's wrong) if the number of log buffers is low at GC start, but tends to get broken otherwise (i.e. with [JDK-8137022](https://bugs.openjdk.org/browse/JDK-8137022)).
> 
> This change fixes this to use the number of cards that were merged in.
> 
> This change depends on PR#10656. Please review that one first if not done otherwise.
> 
> Testing: tier1, checking that no tests use the "Dirty Cards" string now changed.
> 
> Thanks,
>   Thomas

Some renaming suggestions, very subjective.


merged_cards_from_log_buffers -> cards_in_log_buffers
merged_cards_from_rs          -> cards_in_remset
total_cards_merged            -> total_cards
total_cards_scanned           -> scanned_cards

src/hotspot/share/gc/g1/g1Policy.cpp line 843:

> 841:     double merge_to_scan_ratio = 0.0;
> 842:     if (merged_cards_from_rs > 0) {
> 843:       merge_to_scan_ratio = (double)scanned_cards_from_rs / merged_cards_from_rs;

The name is probably wrong; a to b ratio is a/b, I believe.

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

Marked as reviewed by ayang (Reviewer).

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



More information about the hotspot-gc-dev mailing list