Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyiZzz committed Jan 9, 2025
1 parent f527910 commit 3a76d2a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions be/src/util/mem_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {})",
Expand All @@ -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);
Expand Down Expand Up @@ -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<ssize_t>(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<unsigned>("arenas.narenas"); i++) {
set_jemallctl_value<ssize_t>(fmt::format("arena.{}.dirty_decay_ms", i), dirty_decay_ms);
}
#endif
}

Expand Down

0 comments on commit 3a76d2a

Please sign in to comment.