RFR: 8266489: Enable G1 to use large pages on Windows when region size is larger than 2m
Stefan Johansson
sjohanss at openjdk.java.net
Fri May 7 22:08:41 UTC 2021
Please review this change to the large page reservation code on Windows to allow G1 to make use of large pages even if the region size is larger than 2m.
**Summary**
The code handling large pages reservation on Windows fall back to using normal pages if the alignment is larger than the large page size. For G1 this is a problem, because the region size will define the heap alignment which in turn is the alignment used to reserve large pages. This means that for heaps larger than 4G (where the default regions size will be 4m or larger), G1 won't be able to use large pages.
The fix is to handle the case with a larger alignment separately, and first reserve an address that is aligned to the requested alignment, and then use this to reserve the large pages. For the case where there already is a requested address the alignment is not a problem, since that address must already be aligned by the upper layers.
There are two different "ways" to reserve large pages on Windows, one where each page is a separate reservation (used with `UseNUMAInterleaving`) and one where the whole range is a single reservation. I've split those two out into helper functions, since both cases needs to be handled both when finding an aligned address and not. I hope the new code should be fairly easy to follow.
**Testing**
Manual testing to verify the different cases work. Performance testing to see that we actually get large pages and see an improvement. We do! Currently running some more testing together with `UseNUMAInterleaving` to make sure that works as well.
-------------
Commit messages:
- 8266489: Enable G1 to use large pages on Windows with region size large than 2m
Changes: https://git.openjdk.java.net/jdk/pull/3927/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3927&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8266489
Stats: 82 lines in 1 file changed: 57 ins; 0 del; 25 mod
Patch: https://git.openjdk.java.net/jdk/pull/3927.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/3927/head:pull/3927
PR: https://git.openjdk.java.net/jdk/pull/3927
More information about the hotspot-gc-dev
mailing list