--- old/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp 2020-02-17 13:00:57.460759300 +0900 +++ new/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp 2020-02-17 13:00:57.149170000 +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,13 @@ } const size_t expected_block_size = is_tmpfs() ? os::vm_page_size() : os::large_page_size(); - if (expected_block_size != _block_size) { + if (ZAllowHeapOnFileSystem) { + if (ZGranuleSize % _block_size != 0) { + log_error(gc)("Filesystem block size of %s should be multiple of " SIZE_FORMAT, + AllocateHeapAt, _block_size); + return; + } + } else if (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; --- old/src/hotspot/share/gc/z/z_globals.hpp 2020-02-17 13:00:58.519850800 +0900 +++ new/src/hotspot/share/gc/z/z_globals.hpp 2020-02-17 13:00:58.228533300 +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) \