Large page use crashes the JVM on some Linux systems (original) (raw)

Claes Redestad claes.redestad at oracle.com
Mon Apr 23 09🔞23 UTC 2018


[ /bcc amber-dev, /cc hotspot-dev ]

Hi,

unconditionally mapping and unmapping a large page on startup seems sub-optimal to me - could this be checked directly after -XX:+UseLargePages flag has been parsed?

I'd also note that explicitly configured large pages are typically a limited resource: does this test distinguish between a failure due the system not supporting the feature and a failure due not having any free pages left? Printing a "UseLargePages is unsupported" message in the latter case would be misleading.

I wonder if checking something like /proc/meminfo for HugePages_* is a more robust way to probe capabilities, and also whether this is more suited as a test harness feature, i.e., enhance jtreg and tag these tests so that they're ignored on systems that doesn't have any/enough huge pages.

Thanks!

/Claes

On 2018-04-22 23:18, B. Blaser wrote:

[ I've trouble subscribing to hotspot-dev, please forward if necessary. ]

Hi, After a clean build, some hotspot tests related to large page use are failing on my 64-bit Linux system, for example: gc/g1/TestLargePageUseForAuxMemory.java [...] Or simply: $ ./build/linux-x8664-normal-server-release/images/jdk/bin/java -XX:+UseLargePages -version is crashing the JVM because the latter assumes that large pages are always supported on Linux, which appears to be wrong. I suggest to make sure that large pages are supported when parsing the arguments, as below. Does this look reasonable (tier1 looks better now)? Thanks, Bernard diff -r 8c85a1855e10 src/hotspot/share/runtime/arguments.cpp --- a/src/hotspot/share/runtime/arguments.cpp Fri Apr 13 11:14:49 2018 -0700 +++ b/src/hotspot/share/runtime/arguments.cpp Sun Apr 22 20:29:21 2018 +0200 @@ -60,6 +60,7 @@ #include "utilities/defaultStream.hpp" #include "utilities/macros.hpp" #include "utilities/stringUtils.hpp" +#include "sys/mman.h" #if INCLUDEJVMCI #include "jvmci/jvmciRuntime.hpp" #endif @@ -4107,6 +4108,18 @@ UNSUPPORTEDOPTION(UseLargePages); #endif +#ifdef LINUX + void *p = mmap(NULL, os::largepagesize(), PROTREAD|PROTWRITE, + MAPANONYMOUS|MAPPRIVATE|MAPHUGETLB, + -1, 0); + if (p != MAPFAILED) { + munmap(p, os::largepagesize()); + } + else { + UNSUPPORTEDOPTION(UseLargePages); + } +#endif + ArgumentsExt::reportunsupportedoptions(); #ifndef PRODUCT diff -r 8c85a1855e10 test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java --- a/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java Fri Apr 13 11:14:49 2018 -0700 +++ b/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java Sun Apr 22 20:29:21 2018 +0200 @@ -37,7 +37,7 @@ public class TestLargePagesFlags { public static void main(String [] args) throws Exception { - if (!Platform.isLinux()) { + if (!Platform.isLinux() || !canUse(UseLargePages(true))) { System.out.println("Skipping. TestLargePagesFlags has only been implemented for Linux."); return; }



More information about the hotspot-dev mailing list