--- old/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp 2020-02-14 17:56:52.865727700 +0900 +++ new/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp 2020-02-14 17:56:52.069228600 +0900 @@ -138,14 +138,14 @@ _available = buf.f_bavail * _block_size; // Make sure we're on a supported filesystem - if (!is_tmpfs() && !is_hugetlbfs()) { + if (!ZAllowHeapOnFileSystem && !is_tmpfs() && !is_hugetlbfs()) { log_error(gc)("Backing file must be located on a %s or a %s filesystem", ZFILESYSTEM_TMPFS, ZFILESYSTEM_HUGETLBFS); return; } // Make sure the filesystem type matches requested large page type - if (ZLargePages::is_transparent() && !is_tmpfs()) { + if (!ZAllowHeapOnFileSystem && ZLargePages::is_transparent() && !is_tmpfs()) { log_error(gc)("-XX:+UseTransparentHugePages can only be enable when using a %s filesystem", ZFILESYSTEM_TMPFS); return; @@ -170,7 +170,7 @@ } const size_t expected_block_size = is_tmpfs() ? os::vm_page_size() : os::large_page_size(); - if (expected_block_size != _block_size) { + if (!ZAllowHeapOnFileSystem && (expected_block_size != _block_size)) { log_error(gc)("%s filesystem has unexpected block size " SIZE_FORMAT " (expected " SIZE_FORMAT ")", is_tmpfs() ? ZFILESYSTEM_TMPFS : ZFILESYSTEM_HUGETLBFS, _block_size, expected_block_size); return; @@ -201,6 +201,11 @@ } int ZPhysicalMemoryBacking::create_file_fd(const char* name) const { + if (ZAllowHeapOnFileSystem && (AllocateHeapAt == NULL)) { + log_error(gc)("-XX:AllocateHeapAt is needed when ZAllowHeapOnFileSystem is specified"); + return -1; + } + const char* const filesystem = ZLargePages::is_explicit() ? ZFILESYSTEM_HUGETLBFS : ZFILESYSTEM_TMPFS; --- old/src/hotspot/share/gc/z/z_globals.hpp 2020-02-14 17:56:55.619510600 +0900 +++ new/src/hotspot/share/gc/z/z_globals.hpp 2020-02-14 17:56:54.823184100 +0900 @@ -58,6 +58,10 @@ "Uncommit memory if it has been unused for the specified " \ "amount of time (in seconds)") \ \ + experimental(bool, ZAllowHeapOnFileSystem, false, \ + "Allow to use filesystem as Java heap backing storage " \ + "specified by -XX:AllocateHeapAt") \ + \ diagnostic(uint, ZStatisticsInterval, 10, \ "Time between statistics print outs (in seconds)") \ range(1, (uint)-1) \