RFR: JDK-8304954: SegmentedCodeCache fails when using large pages [v2]
Damon Fenacci
dfenacci at openjdk.org
Mon Jul 24 09:31:12 UTC 2023
> # Issue
>
> When large pages are enabled and segmented code cache is used, the VM tries to use one page for each segment. If the amount of reserved code cache is limited, this can make the total size of the code cache bigger than the reserved size, which in turn makes the VM fail, claiming that there is not enough space (e.g. this happens when running `java -XX:+UseLargePages -XX:+SegmentedCodeCache -XX:InitialCodeCacheSize=2g -XX:ReservedCodeCacheSize=2g -XX:LargePageSizeInBytes=1g -Xlog:pagesize*=debug -version`).
> This behaviour is not correct as the VM should fall back and try with a smaller page size (and print a warning).
>
> # Solution
>
> When reserving heap space for code cache we give a minimum of 8 pages. Since the page size is already calculated right before for segment sizes, it is saved and passed as an argument instead.
>
> https://github.com/openjdk/jdk/blob/67fbd87378a9b3861f1676977f9f2b36052add29/src/hotspot/share/code/codeCache.cpp#L315
>
> Additionally a warning is printed if large pages are enabled and we end up using a smaller page sizes for code caching.
>
> # Test
>
> The regression test runs a new VM with `-XX:+UseLargePages -XX:LargePageSizeInBytes=1g`. The `main` method then checks if the two flags have been "taken". If so, another process is started that checks for a specific output, otherwise the test passes (i.e. the current system doesn't allow 1GB large pages)
Damon Fenacci has updated the pull request incrementally with eight additional commits since the last revision:
- JDK-8304954: avoid calculating page_size twice
- JDK-8304954: fix checking output in test
- JDK-8304954: add warning if large pages cannot be used
- Revert "JDK-8304954: SegmentedCodeCache fails when using large pages"
This reverts commit c19d6d45bee3db8f3d51bbf66bc4e6d2616b57e0.
- Revert "JDK-8304954: update warning message"
This reverts commit cfd433d6ba4edc3d0cd9c183a05f9f8514316d52.
- Revert "JDK-8304954: use loop to find smaller page in case there are multiple failing large pages"
This reverts commit ed2b5efc48e34205bb136d1751d4a4544a9915aa.
- Revert "JDK-8304954: print warning only when page size actually changes"
This reverts commit b218957c27556acd3e3c8106b7a2dea65f3664c7.
- Revert "JDK-8304954: fix syntax"
This reverts commit a5ff639918d71185f5b8a7ce946263580803b4f6.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/14903/files
- new: https://git.openjdk.org/jdk/pull/14903/files/876f098b..070d87da
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=14903&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=14903&range=00-01
Stats: 51 lines in 3 files changed: 14 ins; 30 del; 7 mod
Patch: https://git.openjdk.org/jdk/pull/14903.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14903/head:pull/14903
PR: https://git.openjdk.org/jdk/pull/14903
More information about the hotspot-compiler-dev
mailing list