< prev index next >

src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp

Print this page

        

*** 21,34 **** * questions. */ #include "precompiled.hpp" #include "gc/z/zArray.inline.hpp" - #include "gc/z/zBackingPath_linux.hpp" #include "gc/z/zErrno.hpp" #include "gc/z/zGlobals.hpp" #include "gc/z/zLargePages.inline.hpp" #include "gc/z/zPhysicalMemoryBacking_linux.hpp" #include "gc/z/zSyscall_linux.hpp" #include "logging/log.hpp" #include "runtime/init.hpp" #include "runtime/os.hpp" --- 21,34 ---- * questions. */ #include "precompiled.hpp" #include "gc/z/zArray.inline.hpp" #include "gc/z/zErrno.hpp" #include "gc/z/zGlobals.hpp" #include "gc/z/zLargePages.inline.hpp" + #include "gc/z/zMountPoint_linux.hpp" #include "gc/z/zPhysicalMemoryBacking_linux.hpp" #include "gc/z/zSyscall_linux.hpp" #include "logging/log.hpp" #include "runtime/init.hpp" #include "runtime/os.hpp"
*** 205,246 **** const char** const preferred_mountpoints = ZLargePages::is_explicit() ? z_preferred_hugetlbfs_mountpoints : z_preferred_tmpfs_mountpoints; // Find mountpoint ! ZBackingPath path(filesystem, preferred_mountpoints); ! if (path.get() == NULL) { log_error(gc)("Use -XX:ZPath to specify the path to a %s filesystem", filesystem); return -1; } // Try to create an anonymous file using the O_TMPFILE flag. Note that this // flag requires kernel >= 3.11. If this fails we fall back to open/unlink. ! const int fd_anon = os::open(path.get(), O_TMPFILE|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR); if (fd_anon == -1) { ZErrno err; ! log_debug(gc, init)("Failed to create anonymous file in %s (%s)", path.get(), (err == EINVAL ? "Not supported" : err.to_string())); } else { // Get inode number for anonymous file struct stat stat_buf; if (fstat(fd_anon, &stat_buf) == -1) { ZErrno err; log_error(gc)("Failed to determine inode number for anonymous file (%s)", err.to_string()); return -1; } ! log_info(gc, init)("Heap backed by file: %s/#" UINT64_FORMAT, path.get(), (uint64_t)stat_buf.st_ino); return fd_anon; } log_debug(gc, init)("Falling back to open/unlink"); // Create file name char filename[PATH_MAX]; ! snprintf(filename, sizeof(filename), "%s/%s.%d", path.get(), name, os::current_process_id()); // Create file const int fd = os::open(filename, O_CREAT|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR); if (fd == -1) { ZErrno err; --- 205,246 ---- const char** const preferred_mountpoints = ZLargePages::is_explicit() ? z_preferred_hugetlbfs_mountpoints : z_preferred_tmpfs_mountpoints; // Find mountpoint ! ZMountPoint mountpoint(filesystem, preferred_mountpoints); ! if (mountpoint.get() == NULL) { log_error(gc)("Use -XX:ZPath to specify the path to a %s filesystem", filesystem); return -1; } // Try to create an anonymous file using the O_TMPFILE flag. Note that this // flag requires kernel >= 3.11. If this fails we fall back to open/unlink. ! const int fd_anon = os::open(mountpoint.get(), O_TMPFILE|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR); if (fd_anon == -1) { ZErrno err; ! log_debug(gc, init)("Failed to create anonymous file in %s (%s)", mountpoint.get(), (err == EINVAL ? "Not supported" : err.to_string())); } else { // Get inode number for anonymous file struct stat stat_buf; if (fstat(fd_anon, &stat_buf) == -1) { ZErrno err; log_error(gc)("Failed to determine inode number for anonymous file (%s)", err.to_string()); return -1; } ! log_info(gc, init)("Heap backed by file: %s/#" UINT64_FORMAT, mountpoint.get(), (uint64_t)stat_buf.st_ino); return fd_anon; } log_debug(gc, init)("Falling back to open/unlink"); // Create file name char filename[PATH_MAX]; ! snprintf(filename, sizeof(filename), "%s/%s.%d", mountpoint.get(), name, os::current_process_id()); // Create file const int fd = os::open(filename, O_CREAT|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR); if (fd == -1) { ZErrno err;
< prev index next >