RFR: ZGC: Simplify the ZPage life cycle

Per Liden per.liden at oracle.com
Thu Mar 14 00:08:08 UTC 2019


Hi,

Could I please have the following changes reviewed. The main goal with 
this set of patches is to simplify the ZPage life cycle, something we've 
wanted to do for quite some time. This will make future features (such 
as JDK-8220347 - Uncommit unused memory) a lot more straight forward to 
implement.

Changing the ZPage life cycle is mainly about by breaking the dependency 
on ZPage from relocation/forwarding code. Forwarding information is 
moved out from ZPage into the new ZForwarding, which have a life cycle 
separate from ZPage. The new ZForwarding holds the forwarding table plus 
other data needed to do relocation/forwarding. ZForwarding objects are 
registered in the ZForwardingTable, a new data structure analogous to 
the ZPageTable. Once relocation is completed and ZPages are freed up 
they can now be immediately destroyed, if needed. Previously, destroying 
a ZPage could only be done by adding it to the list of detached pages, 
which would be processed after the relocation set had been reset. The 
whole concept of detached pages has now been removed.

The complete change is fairly big, so to make this easier to follow and 
review I've broken it up into 15 discrete patches. However, a webrev 
including all patches below is also available here:

http://cr.openjdk.java.net/~pliden/zgc/zpage_life_cycle/webrev.0/

This change builds on JDK-8220569, which is currently out for review and 
not yet pushed.

These patches change several ZGC internal data structures, which means 
the SA will be out of sync. This is why some of the SA tests have been 
added to the ZGC ProblemList and a separate bug to address this have 
been filed (https://bugs.openjdk.java.net/browse/JDK-8220624).

Testing: Multiple passes of tier1-7 on Linux-x64.


8220586: ZGC: Move relocation logic from ZPage to ZRelocate
-----------------------------------------------------------
Move relocation logic, ZPage::relocate_object() and 
ZPage::forward_object(), to ZRelocate.

https://bugs.openjdk.java.net/browse/JDK-8220586
http://cr.openjdk.java.net/~pliden/8220586/webrev.0


8220587: ZGC: Break out forwarding information from ZPage
---------------------------------------------------------
Break out forwarding information from ZPage into ZForwadring, and 
introduce ZForwardingTable to find ZForwardings given an heap address.

https://bugs.openjdk.java.net/browse/JDK-8220587
http://cr.openjdk.java.net/~pliden/8220587/webrev.0


8220588: ZGC: Convert ZRelocationSet to hold ZForwardings instead of ZPages
--------------------------------------------------------------------
Convert ZRelocationSet to hold ZForwardings instead of ZPages.

https://bugs.openjdk.java.net/browse/JDK-8220588
http://cr.openjdk.java.net/~pliden/8220588/webrev.0


8220589: ZGC: Remove superfluous ZPageTableEntry
------------------------------------------------
ZPageTableEntry has become superfluous and can be removed. The 
ZPageTable can instead just hold ZPage pointers.

https://bugs.openjdk.java.net/browse/JDK-8220589
http://cr.openjdk.java.net/~pliden/8220589/webrev.0


8220590: ZGC: Remove ZPages from ZPageTable when freed
------------------------------------------------------
Remove ZPages from ZPageTable when they are freed, instead of when they 
are destroyed. This means ZPages are no longer present in the page table 
when they are cached.

https://bugs.openjdk.java.net/browse/JDK-8220590
http://cr.openjdk.java.net/~pliden/8220590/webrev.0


8220591: ZGC: Don't delay reclaimation of ZVirtualMemory
--------------------------------------------------------
With the forwarding information detached from the associated ZPage, 
there is no longer any need to delay the reclamation of ZVirtualMemory.

https://bugs.openjdk.java.net/browse/JDK-8220591
http://cr.openjdk.java.net/~pliden/8220591/webrev.0


8220592: ZGC: Move destruction of detached ZPages into ZPageAllocator
---------------------------------------------------------------------
The ZHeap no longer needs to be involved in the destruction of ZPages 
(as they have already been removed from the ZPageTable when they were 
freed), so we can move destruction of detached ZPages into ZPageAllocator.

https://bugs.openjdk.java.net/browse/JDK-8220592
http://cr.openjdk.java.net/~pliden/8220592/webrev.0


8220593: ZGC: Remove superfluous ZPage::is_detached()
-----------------------------------------------------
ZPage::is_detached() is no longer serving any purpose and can be removed.

https://bugs.openjdk.java.net/browse/JDK-8220593
http://cr.openjdk.java.net/~pliden/8220593/webrev.0


8220594: ZGC: Remove superfluous ZPage::is_active()
---------------------------------------------------
ZPage::is_active() is no longer serving any purpose and can be removed.

https://bugs.openjdk.java.net/browse/JDK-8220594
http://cr.openjdk.java.net/~pliden/8220594/webrev.0


8220595: ZGC: Introduce ZAttachedArray
--------------------------------------
Introduce ZAttachedArray, a utility class to help allocating an object 
of type A together with an variable sized array with elements of type B 
in a single allocation. This reduced the number of allocations needed, 
and avoids an indirection to access the array. Useful for data 
structures such as ZForwarding and ZNMethodData.

https://bugs.openjdk.java.net/browse/JDK-8220595
http://cr.openjdk.java.net/~pliden/8220595/webrev.0


8220596: ZGC: Convert ZNMethodData to use ZAttachedArray
--------------------------------------------------------
Convert ZNMethodData to use the newly introduced ZAttachedArray utility 
class.

https://bugs.openjdk.java.net/browse/JDK-8220596
http://cr.openjdk.java.net/~pliden/8220596/webrev.0


8220597: ZGC: Convert ZForwarding to use ZAttachedArray
-------------------------------------------------------
Convert ZForwarding to use the newly introduced ZAttachedArray utility 
class.

https://bugs.openjdk.java.net/browse/JDK-8220597
http://cr.openjdk.java.net/~pliden/8220597/webrev.0


8220599: ZGC: Introduce ZSafeDelete
-----------------------------------
Introduce ZSafeDelete, a utility class to help deleting objects safely 
when they might be accessed concurrently by another threads. This will 
be used to delete both ZPages and ZNMethodTableEntry arrays.

https://bugs.openjdk.java.net/browse/JDK-8220599
http://cr.openjdk.java.net/~pliden/8220599/webrev.0


8220600: ZGC: Delete ZPages using ZSafeDelete
---------------------------------------------
Remove the concept of deferred destruction of detached ZPages, and 
instead delete ZPages using ZSafeDelete.

https://bugs.openjdk.java.net/browse/JDK-8220600
http://cr.openjdk.java.net/~pliden/8220600/webrev.0


8220601: ZGC: Delete ZNMethodTableEntry arrays using ZSafeDelete
----------------------------------------------------------------
Delete ZNMethodTableEntry arrays using ZSafeDelete. This makes the 
ZNMethodAllocator superfluous and it can be removed.

https://bugs.openjdk.java.net/browse/JDK-8220601
http://cr.openjdk.java.net/~pliden/8220601/webrev.0


cheers,
Per



More information about the hotspot-gc-dev mailing list