Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cgroups2] Add memory usage reporting to the MemoryControllerProcess #579

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ if (ENABLE_CGROUPS_v2)
linux/ebpf.cpp
slave/containerizer/mesos/isolators/cgroups2/controller.cpp
slave/containerizer/mesos/isolators/cgroups2/controllers/core.cpp
slave/containerizer/mesos/isolators/cgroups2/controllers/cpu.cpp)
slave/containerizer/mesos/isolators/cgroups2/controllers/cpu.cpp
slave/containerizer/mesos/isolators/cgroups2/controllers/memory.cpp)

endif ()

Expand Down
4 changes: 3 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,9 @@ MESOS_LINUX_FILES += \
slave/containerizer/mesos/isolators/cgroups2/controllers/core.cpp \
slave/containerizer/mesos/isolators/cgroups2/controllers/core.hpp \
slave/containerizer/mesos/isolators/cgroups2/controllers/cpu.cpp \
slave/containerizer/mesos/isolators/cgroups2/controllers/cpu.hpp
slave/containerizer/mesos/isolators/cgroups2/controllers/cpu.hpp \
slave/containerizer/mesos/isolators/cgroups2/controllers/memory.cpp \
slave/containerizer/mesos/isolators/cgroups2/controllers/memory.hpp
endif

if ENABLE_SECCOMP_ISOLATOR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "slave/containerizer/mesos/isolators/cgroups2/cgroups2.hpp"
#include "slave/containerizer/mesos/isolators/cgroups2/controllers/core.hpp"
#include "slave/containerizer/mesos/isolators/cgroups2/controllers/cpu.hpp"
#include "slave/containerizer/mesos/isolators/cgroups2/controllers/memory.hpp"

#include <set>
#include <string>
Expand Down Expand Up @@ -74,7 +75,8 @@ Try<Isolator*> Cgroups2IsolatorProcess::create(const Flags& flags)
{
hashmap<string, Try<Owned<ControllerProcess>>(*)(const Flags&)> creators = {
{"core", &CoreControllerProcess::create},
{"cpu", &CpuControllerProcess::create}
{"cpu", &CpuControllerProcess::create},
{"mem", &MemoryControllerProcess::create}
};

hashmap<string, Owned<Controller>> controllers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ const uint64_t MIN_CPU_SHARES = 2; // Linux constant.
const Duration CPU_CFS_PERIOD = Milliseconds(100); // Linux default.
const Duration MIN_CPU_CFS_QUOTA = Milliseconds(1);

// Memory controller constants.
const Bytes MIN_MEMORY = Megabytes(32);

const std::string CGROUPS_V2_CONTROLLER_CORE_NAME = "core";
const std::string CGROUPS_V2_CONTROLLER_CPU_NAME = "cpu";
const std::string CGROUPS_V2_CONTROLLER_MEMORY_NAME = "memory";

} // namespace slave {
} // namespace internal {
Expand Down
Loading