-
Bug
-
Resolution: Fixed
-
P3
-
22
-
b04
This is a regression introduced by JDK-8261894.
It modified `os::can_execute_large_page_memory`:
```
bool os::can_execute_large_page_memory() {
- return UseTransparentHugePages || UseHugeTLBFS;
+ return UseTransparentHugePages;
}
```
CodeCache::page_size uses `os::can_execute_large_page_memory` to detect page sizes. It fails when static huge pages are used. This results static huge pages are not used for CodeCache.
The correct code should be:
```
bool os::can_execute_large_page_memory() {
return UseLargePages;
}
```
Here is a log showing static huge pages are used for the Java heap but not for CodeCache.
```
% uname -r -s
Linux 5.4.258-178.360.amzn2int.x86_64
% cat /proc/meminfo | grep -i huge
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
FileHugePages: 0 kB
HugePages_Total: 100
HugePages_Free: 100
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 204800 kB
% bin/java -Xms100m -Xmx100m -XX:-TieredCompilation -XX:InitialCodeCacheSize=48m -XX:+UseLargePages -Xlog:pagesize=info -version
[0.001s][info][pagesize] Static hugepage support:
[0.001s][info][pagesize] hugepage size: 2M
[0.001s][info][pagesize] hugepage size: 1G
[0.001s][info][pagesize] default hugepage size: 2M
[0.001s][info][pagesize] Transparent hugepage (THP) support:
[0.001s][info][pagesize] THP mode: madvise
[0.001s][info][pagesize] THP pagesize: 2M
[0.001s][info][pagesize] Using the default large page size: 2M
[0.001s][info][pagesize] UseLargePages=1, UseTransparentHugePages=0
[0.001s][info][pagesize] Large page support enabled. Usable page sizes: 4k, 2M. Default large page size: 2M.
[0.002s][info][pagesize] CodeCache: min=48M max=48M base=0x00007f3d60ad4000 size=48M page_size=4K
[0.089s][info][pagesize] Heap: min=100M max=100M base=0x00000000f9c00000 size=100M page_size=2M
[0.089s][info][pagesize] Block Offset Table: req_size=200K req_page_size=4K base=0x00007f3d60098000 size=200K page_size=4K
[0.089s][info][pagesize] Card Table: req_size=200K req_page_size=4K base=0x00007f3d60066000 size=200K page_size=4K
[0.089s][info][pagesize] Mark Bitmap: req_size=1600K req_page_size=4K base=0x00007f3d5893b000 size=1600K page_size=4K
openjdk version "22-internal" 2024-03-19
OpenJDK Runtime Environment (fastdebug build 22-internal-adhoc.eastig.jdk)
OpenJDK 64-Bit Server VM (fastdebug build 22-internal-adhoc.eastig.jdk, mixed mode)
```
It modified `os::can_execute_large_page_memory`:
```
bool os::can_execute_large_page_memory() {
- return UseTransparentHugePages || UseHugeTLBFS;
+ return UseTransparentHugePages;
}
```
CodeCache::page_size uses `os::can_execute_large_page_memory` to detect page sizes. It fails when static huge pages are used. This results static huge pages are not used for CodeCache.
The correct code should be:
```
bool os::can_execute_large_page_memory() {
return UseLargePages;
}
```
Here is a log showing static huge pages are used for the Java heap but not for CodeCache.
```
% uname -r -s
Linux 5.4.258-178.360.amzn2int.x86_64
% cat /proc/meminfo | grep -i huge
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
FileHugePages: 0 kB
HugePages_Total: 100
HugePages_Free: 100
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 204800 kB
% bin/java -Xms100m -Xmx100m -XX:-TieredCompilation -XX:InitialCodeCacheSize=48m -XX:+UseLargePages -Xlog:pagesize=info -version
[0.001s][info][pagesize] Static hugepage support:
[0.001s][info][pagesize] hugepage size: 2M
[0.001s][info][pagesize] hugepage size: 1G
[0.001s][info][pagesize] default hugepage size: 2M
[0.001s][info][pagesize] Transparent hugepage (THP) support:
[0.001s][info][pagesize] THP mode: madvise
[0.001s][info][pagesize] THP pagesize: 2M
[0.001s][info][pagesize] Using the default large page size: 2M
[0.001s][info][pagesize] UseLargePages=1, UseTransparentHugePages=0
[0.001s][info][pagesize] Large page support enabled. Usable page sizes: 4k, 2M. Default large page size: 2M.
[0.002s][info][pagesize] CodeCache: min=48M max=48M base=0x00007f3d60ad4000 size=48M page_size=4K
[0.089s][info][pagesize] Heap: min=100M max=100M base=0x00000000f9c00000 size=100M page_size=2M
[0.089s][info][pagesize] Block Offset Table: req_size=200K req_page_size=4K base=0x00007f3d60098000 size=200K page_size=4K
[0.089s][info][pagesize] Card Table: req_size=200K req_page_size=4K base=0x00007f3d60066000 size=200K page_size=4K
[0.089s][info][pagesize] Mark Bitmap: req_size=1600K req_page_size=4K base=0x00007f3d5893b000 size=1600K page_size=4K
openjdk version "22-internal" 2024-03-19
OpenJDK Runtime Environment (fastdebug build 22-internal-adhoc.eastig.jdk)
OpenJDK 64-Bit Server VM (fastdebug build 22-internal-adhoc.eastig.jdk, mixed mode)
```
- relates to
-
JDK-8317831 compiler/codecache/CheckLargePages.java fails on OL 8.8 with unexpected memory string
- Resolved
-
JDK-8261894 Remove support for UseSHM
- Resolved