RFR: 8199674: Improve G1 Full GC array marking
Stefan Johansson
stefan.johansson at oracle.com
Thu Mar 15 13:05:01 UTC 2018
Hi,
Please review this change to improve the Full GC marking code.
Links
JBS: https://bugs.openjdk.java.net/browse/JDK-8199674
Webrev: http://cr.openjdk.java.net/~sjohanss/8199674/00/
Summary
Currently when marking an object array it is split up to avoid one
worker doing all the work. The code iterates over a chunk of the array
and then push a task for the rest of the array to the marking stack. The
problem with this is that if the iteration it self don't find any new
pointers to follow, the next thing to do is to handle the next chunk in
the array. This make work-stealing problematic and the performance far
from optimal.
There are many schemes that can be used to improve the situation and we
might want to dig into this more at some point. The fix I propose here
is simple and easy but gives good improvements to the micro benchmarks
I've tested it on. The fix is to push the task for the rest of the array
onto the mark stack before doing the iteration of the current chunk.
Testing
Functional testing through mach5 and local performance testing. Created
two small JMH benchmarks that create a big object array, one fills it
with object the other one is completely empty.
Baseline:
Benchmark Mode Cnt Score Error Units
SystemGCOneBigEmpty.bench ss 25 179.740 ± 8.497 ms/op
SystemGCOneBigFull.bench ss 25 5220.095 ± 192.680 ms/op
With patch applied:
Benchmark Mode Cnt Score Error Units
SystemGCOneBigEmpty.bench ss 25 111.854 ± 7.596 ms/op
SystemGCOneBigFull.bench ss 25 1713.544 ± 36.956 ms/op
These benchmarks measure the whole time of the Full GC and not only the
marking times but the improvement is still pretty clear.
Thanks,
Stefan
More information about the hotspot-gc-dev
mailing list