RFR (XS) 8215221: Serial GC misreports young GC time

Man Cao manc at google.com
Fri Feb 22 03:43:16 UTC 2019


Hi Aleksey,

The patch looks mostly good to me but I think I found a minor behavior
change (bug).
It seems it causes double counting on
CollectedHeap._total_full_collections, if complete==true &&
do_young_collection==true && do_full_collection==true.
The cause is the following:

 645     if (!do_young_collection) {
 646       gc_prologue(complete);
 647       increment_total_collections();
 648     }
 649     increment_total_full_collections();

I can expose the issue with the following command:
$ java -XX:+UseSerialGC -XX:+ScavengeBeforeFullGC -Xlog:gc*,gc+heap=debug
-Xmx30m -jar dacapo-9.12-bach.jar fop -n 5
Then compare the number of lines with "Pause Full" against the full count
in the line "Heap after GC invocations=XX (full XX)" after last GC.

I found the following could fix the problem (yes, it's ugly, but I couldn't
find cleaner way that works in all cases):

if (!do_young_collection) {
  gc_prologue(complete);
  increment_total_collections(complete);
}
if (!complete) {
  increment_total_full_collections();
}

I also found that CollectedHeap._total_collections seems wrong with or
without this change, for SerialGC and CMS.
It is smaller than the actual number of collections according to the GC ID.
Reproduction recipe is the same as above.

-Man
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/hotspot-gc-dev/attachments/20190221/2c14891f/attachment.html>


More information about the hotspot-gc-dev mailing list