RFR: 8245203/8245204/8245208: ZGC: Don't hold the ZPageAllocator lock while committing/uncommitting memory

Per Liden per.liden at oracle.com
Mon May 18 21:23:29 UTC 2020

Please review this series of three patches to rework the page allocation 
path so that we don't hold the ZPageAllocator lock while 
committing/uncommitting memory. Patch 1 & 2 are small and preparatory. 
Patch 3 is the main patch and it's unfortunately fairly large as it was 
hard to break up in a sensible way.


1) 8245203: ZGC: Don't track size in ZPhysicalMemoryBacking

To make it easier to allow for more concurrent commit/uncommit we should 
not track the backing "size" in ZPhysicalMemoryBacking. Instead we can 
add the full physical memory range (from 0 to max_capacity) to the list 
of uncommitted memory at startup. This removes the need to track and 
update the backing size (which otherwise needs to be properly synchronized).

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


2) 8245204: ZGC: Introduce ZListRemoveIterator

Add ZListRemoveIterator, which unlike ZListIterator, iterates over a 
non-const "ZList<T>" and each call to "next()" also removes the returned 
element from the list.

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


3) 8245208: ZGC: Don't hold the ZPageAllocator lock while 
committing/uncommitting memory

We're currently holding the ZPageAllocator lock while performing a 
number of expensive operations, such as committing and uncommitting 
memory. This can have a very negative impact on latency, for example, 
when a Java thread is trying to allocate a page from the page cache 
while the ZUncommitter thread is uncommitting a portion of the heap.

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


Testing: More than 10 runs of Tier1-7 on all ZGC supported platforms. 
Manual testing to provoke various error conditions on Linux.

This patchset also solves 
https://bugs.openjdk.java.net/browse/JDK-8242527 as a side-effect.


More information about the hotspot-gc-dev mailing list