--- old/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp 2020-02-17 11:00:02.209511853 +0100 +++ new/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp 2020-02-17 11:00:01.877505117 +0100 @@ -137,16 +137,9 @@ _block_size = buf.f_bsize; _available = buf.f_bavail * _block_size; - // Make sure we're on a supported filesystem - if (!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()) { - log_error(gc)("-XX:+UseTransparentHugePages can only be enable when using a %s filesystem", + log_error(gc)("-XX:+UseTransparentHugePages can only be enabled when using a %s filesystem", ZFILESYSTEM_TMPFS); return; } @@ -169,10 +162,22 @@ return; } - const size_t expected_block_size = is_tmpfs() ? os::vm_page_size() : os::large_page_size(); - if (expected_block_size != _block_size) { + if (ZLargePages::is_explicit() && os::large_page_size() != ZGranuleSize) { + log_error(gc)("Incompatible large page size configured " SIZE_FORMAT " (expected " SIZE_FORMAT ")", + os::large_page_size(), ZGranuleSize); + return; + } + + // Make sure the filesystem block size is compatible + if (ZGranuleSize % _block_size != 0) { + log_error(gc)("Filesystem backing the heap has incompatible block size (" SIZE_FORMAT ")", + _block_size); + return; + } + + if (is_hugetlbfs() && _block_size != os::large_page_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); + ZFILESYSTEM_HUGETLBFS, _block_size, os::large_page_size()); return; }