Integrated: JDK-8304954: SegmentedCodeCache fails when using large pages

Damon Fenacci dfenacci at openjdk.org
Fri Jul 28 09:12:59 UTC 2023


On Mon, 17 Jul 2023 13:34:55 GMT, Damon Fenacci <dfenacci at openjdk.org> wrote:

> # 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)

This pull request has now been integrated.

Changeset: cad6114e
Author:    Damon Fenacci <dfenacci at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/cad6114e1c69bfebe5f7892c3e105b4c70d04398
Stats:     115 lines in 3 files changed: 109 ins; 1 del; 5 mod

8304954: SegmentedCodeCache fails when using large pages

Reviewed-by: stuefe, thartmann

-------------

PR: https://git.openjdk.org/jdk/pull/14903


More information about the hotspot-compiler-dev mailing list