RFR: 8364114: Test TestHugePageDecisionsAtVMStartup.java#LP_enabled fails when no free hugepage

Thomas Stuefe stuefe at openjdk.org
Fri Jul 25 13:50:57 UTC 2025


On Fri, 25 Jul 2025 12:47:23 GMT, SendaoYan <syan at openjdk.org> wrote:

> Hi all,
> 
> The test runtime/os/TestHugePageDecisionsAtVMStartup.java#LP_enabled will fails when there is no free hugepases.
> The /proc/meminfo and /sys/kernel/mm/hugepages/hugepages-*/free_hugepages says there is no free hugepage, and the JVM output also say there is available large page.
> 
> 
>> cat /proc/meminfo | grep -i HugePages
> AnonHugePages:         0 kB
> ShmemHugePages:        0 kB
> FileHugePages:         0 kB
> HugePages_Total:       2
> HugePages_Free:        0
> HugePages_Rsvd:        0
> HugePages_Surp:        2
> Hugepagesize:       2048 kB
> 
>> ( set -x ; cat /sys/kernel/mm/hugepages/hugepages-*/free_hugepages )
> + cat /sys/kernel/mm/hugepages/hugepages-1048576kB/free_hugepages /sys/kernel/mm/hugepages/hugepages-2048kB/free_hugepages
> 0
> 0
> 
> JVM output snippet from java -XX:+UseLargePages -Xlog:pagesize -version
> [0.001s][info][pagesize] Large page size (2M) failed sanity check, checking if smaller large page sizes are usable
> [0.001s][warning][pagesize] UseLargePages disabled, no large pages configured and available on the system.
> 
> 
> The JVM can not use large page when there is no available large page on system, it's not a JVM bug. So I think it's not suitable to report test failure, but report SkippedException.
> 
> Change has been verified locally, test report SkippedException on the system without free hugepage, the test passes on the system with free hugepage. Test-fix only, risk is low.

Thanks for fixing this.

Side note, I was long on the fence about just throwing that JVM-side startup test out. Since it seems superfluous - without the test, we would just proceed allocating the heap, not get the desired large pages, which would produce almost the same result. And it is no guarantee anyway, since we may pass the test and later fail to allocate the much larger heap.

test/hotspot/jtreg/runtime/os/TestHugePageDecisionsAtVMStartup.java line 32:

> 30:  * @modules java.base/jdk.internal.misc
> 31:  *          java.management
> 32:  * @build jtreg.SkippedException

I don't think these should be needed, should they?

test/lib/jdk/test/lib/os/linux/HugePageConfiguration.java line 186:

> 184:         return 0;
> 185:     }
> 186: 

Can you do it a bit more like the rest of the class - read this info in readFromOS and store it in a member? Print it with toString()? Then we see it in the test output, could be useful. But it cannot be part of the equals() comparison, I think, since there is no direct counterpart on the JVM-side log.

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

Changes requested by stuefe (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26480#pullrequestreview-3055450911
PR Review Comment: https://git.openjdk.org/jdk/pull/26480#discussion_r2231116545
PR Review Comment: https://git.openjdk.org/jdk/pull/26480#discussion_r2231127605


More information about the hotspot-runtime-dev mailing list