RFR/C: 8218922: SA: Enable best-effort implementation of live regions iteration for ZGC

Stefan Karlsson stefan.karlsson at oracle.com
Fri Feb 15 19:25:54 UTC 2019

Testing showed that the re-enabling of the retiring of TLABs was broken. 
This has been fixed with this patch:


During mark start we change what's considered the "good" view of the 
heap, and if -XX:+ZUnmapBadViews is turned on we actually unmap the 
previous good view. This happens before TLABs are retired and filler 
objects get written. This used to work when we didn't create filler 
objects for TLABs, but know that we do, we need to ensure that the TLAB 
pointers have the correct colors, otherwise we'll end up crashing when 
-XX:+ZUnmapBadViews are used.

With this fix, the patches passes tier1,tier2, and tier3 testing.


On 2019-02-13 15:52, Stefan Karlsson wrote:
> Hi all,
> Please review / comment on this patch to enable a best-effort live 
> heap region iteration implementation in ZGC.
> http://cr.openjdk.java.net/~stefank/8218922/webrev.01/
> https://bugs.openjdk.java.net/browse/JDK-8218922
> The SA has functionally that relies on live heap region information 
> from the GCs. This is problematic when dead objects are left in the 
> heap, and their classes have been unloaded.
> Because of this ZGC has so far not implemented this feature. However, 
> we could provide a best-effort implementation that most likely will 
> work if classes are not unloaded (or class unloading is turned off), 
> and otherwise might fail to fully parse and report all live heap regions.
> For active, non-relocating pages the patch simply returns [start, top) 
> and for pages being actively relocated, it reports regions containing 
> the non-forwarded objects, the other objects are either dead or could 
> be found in one of the to-regions.
> With this patch I'm able to get heap histograms with ZGC.
> Maybe this is enough to enable a bit more SA debugging capabilities 
> when running with ZGC? What do you think, should we bring in this change?
> To be able to implement this more cleanly I've restructured the live 
> region collection, and pushed GC specific code into the specific GCs. 
> There are some extra usage of generics to make the code a bit easier 
> to read and develop.
> Thanks,
> StefanK

More information about the hotspot-gc-dev mailing list