RFR: 8252973: ZGC: Windows large pages support

Stefan Karlsson stefank at openjdk.java.net
Thu Nov 12 11:22:03 UTC 2020

Please review this patch to add large pages support to ZGC on Windows.

The patch uses a shared AWE section to reserve, commit, and map memory. I've split the code into two implementations, one for the old small pages support, and one for the large pages support. The large pages implementation is chosen if the required APIs are available, memory locking privileges has been setup in Windows (standard requirement for enabling large pages), and the user has selected large pages.

Comparing the small and large pages implementations:

The AWE API requires that the AWE section is provided during the memory reservation stage, and also when committing memory. Previously, ZGC has not needed to share information between the virtual memory layer and the physical memory layer, so there's no straight forward way to pass the section over to the physical memory layer. To keep this dependency local to the Windows implementation, I've chose to use a global reference to the section.

There's no need to use the placeholder API. The placeholders were needed to atomically replace a memory reservation with committed memory and at the same time support memory mapping. The placeholders needed to be dynamically split and coalesced, and some extra infrastructure were added for that. This is not needed with the AWE APIs, and makes that implementation a bit easier to understand IMHO.

When committing memory, the small pages implementation creates one paging file handle per ZGranule (2MB). This allows us to commit/uncommit at arbitrary 2MB boundaries. In the AWE implementation, it's very similar, but whereas the previous implementation chose to use a 2MB boundary, the AWE requires us to keep track of on handle per physical page (2MB again).

The shared AWE memory APIs are available since Windows version 1809. Thanks to Microsoft (@mo-beck and the memory management team) for describing how these APIs could be used to implement the operations we require to support large pages on Windows.


Commit messages:
 - 8252973: ZGC: Windows large pages support

Changes: https://git.openjdk.java.net/jdk/pull/1184/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1184&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8252973
  Stats: 531 lines in 11 files changed: 374 ins; 70 del; 87 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1184.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1184/head:pull/1184

PR: https://git.openjdk.java.net/jdk/pull/1184

More information about the hotspot-gc-dev mailing list