ZGC and 1G pages?

Stefan Karlsson stefan.karlsson at oracle.com
Mon May 8 11:07:22 UTC 2023


On 2023-05-08 11:27, Thomas Stüfe wrote:
> Hi Stefan,
>
> On Mon, May 8, 2023 at 11:08 AM Stefan Karlsson 
> <stefan.karlsson at oracle.com> wrote:
>
>     Hi Thomas,
>
>     On 2023-05-08 10:50, Thomas Stüfe wrote:
>     > Hi,
>     >
>     > ZGC, on Linux, seems only compatible with 2M pages. Seeing that
>     ZGC is
>     > often used with very large heaps, is support for 1GB pages planned?
>
>     There's currently no plan to support 1GB explicit larges pages.
>
>     >
>     > Especially if one disregards uncommitting (-ZUncommit), 1G pages
>     could
>     > be a speed boost for customers with gigantic heaps, as well as
>     reduce
>     > their number of VMAs.
>
>     One hurdle to get 1GB pages to work is that we take the physical
>     backing
>     memory of multiple discontiguous 2MB heap regions and combine them
>     into
>     a larger contiguous memory region. To implement 1GB large pages
>     support
>     we need to figure out how to perform that detaching of physical
>     memory
>     from virtual memory if the 2MB regions reside on 1GB large pages.
>
>
> Thank you for clarifying!
>
> This is probably a naive question, but would increasing the zpage size 
> to 1GB be a valid option?

I see a few problems, but there are probably more lurking:

1) This would waste a significant amount of memory. We have a number of 
reason why we have a couple of active pages per worker and/or CPU.

2) Allocating large heap region and initializing associated data 
structures can take some times. A lot of it can be prevented by using 
-Xmx == -Xms and -XX:+AlwaysPreTouch.

3) I think it would break some address compression schemes we have. For 
example, take a look at ZForwardingEntry and the "From Object Index" 
part. That portion will not fit for small objects in 1GB pages.

So, I think it would be possible to do, but you would have to rewrite 
parts of the GC.

StefanK

> ..Thomas
>
>
>     StefanK
>
>     >
>     > Thanks, Thomas
>     >
>     >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/zgc-dev/attachments/20230508/01f210f2/attachment.htm>


More information about the zgc-dev mailing list