RFR: 8234338: ZGC: Improve small heap usage

Stefan Karlsson stefan.karlsson at oracle.com
Tue Nov 19 19:06:37 UTC 2019

Hi Per,

Looks good.

I would have preferred if the per_cpu_shared_small_page() function were 
prefixed with use_. I was again confused by that function when reading 
this for the second time. I'll let you decide if you agree or not.


On 2019-11-19 19:54, Per Liden wrote:
> When using small heaps (like less than 128M), the heap reserve tends 
> to take up a relatively large portion of the heap. We have quite a lot 
> of tests that explicitly set the heap size to small values (like 
> -Xmx8M, -Xmx16M, etc). Today, these tests often fail with OOME when 
> using ZGC. While ZGC isn't really that focused on tiny/small heaps, we 
> still want to make testing of ZGC easy without having to adjust these 
> tests to use a larger heap.
> There are at least two things we can do when ZGC is given a small heap:
> 1) Dynamically scale the medium ZPage size, and even disable medium 
> pages all together when using tiny heaps.
> 2) Stop using per-CPU small pages for allocations, and instead switch 
> to using a single small page.
> With this patch, ZGC can scale down to 8M.
> Bug: https://bugs.openjdk.java.net/browse/JDK-8234338
> Webrev: http://cr.openjdk.java.net/~pliden/8234338/webrev.0
> Testing: Tier1-7 using ZGC. A new small heap test was also added.
> /Per

More information about the hotspot-gc-dev mailing list