From 3a76d2aa25566a3dbe5012f3b6a1b9188765e67b Mon Sep 17 00:00:00 2001 From: Zou Xinyi Date: Thu, 9 Jan 2025 17:30:55 +0800 Subject: [PATCH] 1 --- be/src/util/mem_info.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/be/src/util/mem_info.h b/be/src/util/mem_info.h index 5d1d0c75367673..3fa0fdbd709209 100644 --- a/be/src/util/mem_info.h +++ b/be/src/util/mem_info.h @@ -107,6 +107,8 @@ class MemInfo { size_t value_size = sizeof(T); if (jemallctl(name.c_str(), &value, &value_size, nullptr, 0) == 0) { return value; + } else { + LOG(WARNING) << fmt::format("Failed, jemallctl get {}", name); } #endif return 0; @@ -123,9 +125,6 @@ class MemInfo { if (err) { LOG(WARNING) << fmt::format("Failed, jemallctl value for {} set to {} (old {})", name, value, old_value); - } else { - LOG(INFO) << fmt::format("Successfully, jemallctl value for {} set to {} (old {})", - name, value, old_value); } } catch (...) { LOG(WARNING) << fmt::format("Exception, jemallctl value for {} set to {} (old {})", @@ -140,8 +139,6 @@ class MemInfo { int err = jemallctl(name.c_str(), nullptr, nullptr, nullptr, 0); if (err) { LOG(WARNING) << fmt::format("Failed, jemallctl action {}", name); - } else { - LOG(INFO) << fmt::format("Successfully, jemallctl action {}", name); } } catch (...) { LOG(WARNING) << fmt::format("Exception, jemallctl action {}", name); @@ -181,8 +178,12 @@ class MemInfo { // Each time this interface is set, all currently unused dirty pages are considered // to have fully decayed, which causes immediate purging of all unused dirty pages unless // the decay time is set to -1 - set_jemallctl_value(fmt::format("arena.{}.dirty_decay_ms", MALLCTL_ARENAS_ALL), - dirty_decay_ms); + // + // NOTE: Using "arena.MALLCTL_ARENAS_ALL.dirty_decay_ms" to modify all arenas will fail or even crash, + // which may be a bug. + for (unsigned i = 0; i < get_jemallctl_value("arenas.narenas"); i++) { + set_jemallctl_value(fmt::format("arena.{}.dirty_decay_ms", i), dirty_decay_ms); + } #endif }