From 6b3256770e65292be4dfb637f04787ec2918c7cd Mon Sep 17 00:00:00 2001 From: Minhan Cao Date: Tue, 4 Feb 2025 13:13:50 -0800 Subject: [PATCH] Added logging of actual total memory and which cgroup --- .../presto_cpp/main/LinuxMemoryChecker.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/presto-native-execution/presto_cpp/main/LinuxMemoryChecker.cpp b/presto-native-execution/presto_cpp/main/LinuxMemoryChecker.cpp index c2ba63e14c547..eac88aafe2f39 100644 --- a/presto-native-execution/presto_cpp/main/LinuxMemoryChecker.cpp +++ b/presto-native-execution/presto_cpp/main/LinuxMemoryChecker.cpp @@ -30,12 +30,17 @@ class LinuxMemoryChecker : public PeriodicMemoryChecker { struct stat buffer; if ((stat(kCgroupV1Path, &buffer) == 0)) { statFile_ = kCgroupV1Path; + LOG(INFO) << fmt::format( + "Using cgroup v1 memory stat file: {}", statFile_); } else if ((stat(kCgroupV2Path, &buffer) == 0)) { statFile_ = kCgroupV2Path; + LOG(INFO) << fmt::format( + "Using cgroup v2 memory stat file: {}", statFile_); } else { statFile_ = "None"; + LOG(INFO) << fmt::format( + "Could not find memory stat file: {}", statFile_); } - LOG(INFO) << fmt::format("Using memory stat file {}", statFile_); // Set memMaxFile_ to: // "/sys/fs/cgroup/memory/memory.limit_in_bytes" for cgroup v1 @@ -43,12 +48,16 @@ class LinuxMemoryChecker : public PeriodicMemoryChecker { // "/sys/fs/cgroup/memory.max" for cgroup v2. if ((stat(kCgroupV1MaxMemFilePath, &buffer) == 0)) { memMaxFile_ = kCgroupV1MaxMemFilePath; + LOG(INFO) << fmt::format( + "Using cgroup v1 memory max file {}", memMaxFile_); } else if ((stat(kCgroupV2MaxMemFilePath, &buffer) == 0)) { memMaxFile_ = kCgroupV2MaxMemFilePath; + LOG(INFO) << fmt::format( + "Using cgroup v2 memory max file {}", memMaxFile_); } else { memMaxFile_ = "None"; + LOG(INFO) << fmt::format("Could not find memory max file: {}", statFile_); } - LOG(INFO) << fmt::format("Using memory max file {}", memMaxFile_); } ~LinuxMemoryChecker() override {} @@ -77,10 +86,12 @@ class LinuxMemoryChecker : public PeriodicMemoryChecker { // Check system-memory-gb < system-mem-limit-gb < actual total memory // capacity. int64_t actualTotalMemory = getActualTotalMemory(); + LOG(INFO) << fmt::format( + "Actual total memory in bytes: {}", actualTotalMemory); VELOX_CHECK_LE( config_.systemMemLimitBytes, actualTotalMemory, - "system-mem-limit-gb = {} is higher than the actual total memory capacity {} gb.", + "system memory limit = {} bytes is higher than the actual total memory capacity = {} bytes.", config_.systemMemLimitBytes, actualTotalMemory);