-
Enhancement
-
Resolution: Unresolved
-
P4
-
17
-
linux, windows
If we start the VM with UseLargePages, we round up the heap size to the large page size:
https://github.com/openjdk/jdk/blob/aba22656829913d5f8d619a184c929a7de8431e4/src/hotspot/share/memory/universe.cpp#L815
Can be easily reproduced even on a normal (2g large pages) linux x64:
```
thomas@starfish:/shared/projects/openjdk$ ./jdk-jdk/output-fastdebug/images/jdk/bin/java -XX:+UseLargePages -Xmx32769k -Xlog:pagesize -version
...
[0.047s][info][pagesize] Heap: min=8M max=34M base=0x00000000fde00000 page_size=2M size=34M
^^^
```
(We start with 32m+1k, but use 34m)
This is maybe acceptable for "small" large pages of 2MB, but with larger large pages this becomes an issue.
See JDK-8267460, where a test error on an AARCH64 machine with 64k base- and 512m huge page size means that a VM started with 128m heap size and UseLargePages will grab a heap of 512m.
This calculation happens before reservation. If we then fail to grab a huge page, we will use up a virtual size of 512m, which is bearable (apart from the surprisingly large heap limit). But if we actually get a huge page, all that memory is committed and used right away.
I am sure we face the same issue with 1g pages on x64. But unfortunately I don't have a system with large large pages to test this. I am also not sure whether this would affect Windows.
https://github.com/openjdk/jdk/blob/aba22656829913d5f8d619a184c929a7de8431e4/src/hotspot/share/memory/universe.cpp#L815
Can be easily reproduced even on a normal (2g large pages) linux x64:
```
thomas@starfish:/shared/projects/openjdk$ ./jdk-jdk/output-fastdebug/images/jdk/bin/java -XX:+UseLargePages -Xmx32769k -Xlog:pagesize -version
...
[0.047s][info][pagesize] Heap: min=8M max=34M base=0x00000000fde00000 page_size=2M size=34M
^^^
```
(We start with 32m+1k, but use 34m)
This is maybe acceptable for "small" large pages of 2MB, but with larger large pages this becomes an issue.
See JDK-8267460, where a test error on an AARCH64 machine with 64k base- and 512m huge page size means that a VM started with 128m heap size and UseLargePages will grab a heap of 512m.
This calculation happens before reservation. If we then fail to grab a huge page, we will use up a virtual size of 512m, which is bearable (apart from the surprisingly large heap limit). But if we actually get a huge page, all that memory is committed and used right away.
I am sure we face the same issue with 1g pages on x64. But unfortunately I don't have a system with large large pages to test this. I am also not sure whether this would affect Windows.
- relates to
-
JDK-8267460 runtime/os/TestTracePageSizes.java#with-Serial fails on linux-aarch64 since JDK-8267155
- Open