After JDK-8262188 added the new test, I am seeing the failures on some (older) kernels like these:
Added range: [ffffffffff600000, ffffffffff601000) pageSize=4KB isTHP=false isHUGETLB=false, vmFlags = rd ex
From logfile: [0.003s][info][pagesize] CodeHeap 'non-nmethods': min=4M max=8M base=0x00007f1b57c00000 page_size=2M size=8M
From smaps: [7f1b57c00000, 7f1b58000000) pageSize=4KB isTHP=false isHUGETLB=false, vmFlags = rd wr ex mr mw me ac
Failure: 4 != 2048
STDERR:
java.lang.AssertionError: Page sizes mismatch: 4 != 2048
at TestTracePageSizes.main(TestTracePageSizes.java:149)
...while on other (newer?) kernels it passes with:
Added range: [ffffffffff600000, ffffffffff601000) pageSize=4KB isTHP=false isHUGETLB=false, vmFlags=ex
From logfile: [0.002s][info][pagesize] CodeHeap 'non-nmethods': min=4M max=10M base=0x00007f7b50000000 page_size=2M size=10M
From smaps: [7f7b50000000, 7f7b50400000) pageSize=4KB isTHP=true isHUGETLB=false, vmFlags=rd wr ex mr mw me ac sd hg
Success: 2048 > 4 and THP enabled
It seems as if "hg" flag that is supposed to show that VMA block was madvised for THP is missing on some kernels. Both machines above have THP on:
$ cat /sys/kernel/mm/transparent_hugepage/{enabled,defrag}
always [madvise] never
always defer [madvise] never
Every test configuration with -XX:+UseTransparentHugePages seems to fail.
Test passes on machine with:
Linux ... 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
...and fails on machine with:
Linux ... 4.9.0-14-amd64 #1 SMP Debian 4.9.246-2 (2020-12-17) x86_64 GNU/Linux