This is an automated email from the ASF dual-hosted git repository. jieyu pushed a commit to branch 1.4.x in repository https://gitbox.apache.org/repos/asf/mesos.git
commit e27293603f47b20a51f786fd02125cc9f123ff75 Author: Jie Yu <yujie....@gmail.com> AuthorDate: Fri Sep 28 15:55:59 2018 -0700 Cached the cgroup results in Docker containerizer. Since the cgroup hierarchy results won't change, it does not make sense to compute it every time `usage` is called. It will get quite expensivie when the host mount table is big (e.g., MESOS-8418). This patch uses the static local variable to cache the result. Review: https://reviews.apache.org/r/68880 (cherry picked from commit 59b92a948fab386542f5ddfee275066694cf1f96) --- src/slave/containerizer/docker.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp index 79d1caa..5807751 100644 --- a/src/slave/containerizer/docker.cpp +++ b/src/slave/containerizer/docker.cpp @@ -2018,8 +2018,8 @@ Try<ResourceStatistics> DockerContainerizerProcess::cgroupsStatistics( #ifndef __linux__ return Error("Does not support cgroups on non-linux platform"); #else - const Result<string> cpuacctHierarchy = cgroups::hierarchy("cpuacct"); - const Result<string> memHierarchy = cgroups::hierarchy("memory"); + static const Result<string> cpuacctHierarchy = cgroups::hierarchy("cpuacct"); + static const Result<string> memHierarchy = cgroups::hierarchy("memory"); // NOTE: Normally, a Docker container should be in its own cgroup. // However, a zombie process (exited but not reaped) will be @@ -2094,7 +2094,7 @@ Try<ResourceStatistics> DockerContainerizerProcess::cgroupsStatistics( // Add the cpu.stat information only if CFS is enabled. if (flags.cgroups_enable_cfs) { - const Result<string> cpuHierarchy = cgroups::hierarchy("cpu"); + static const Result<string> cpuHierarchy = cgroups::hierarchy("cpu"); if (cpuHierarchy.isError()) { return Error(