bmahler commented on code in PR #563: URL: https://github.com/apache/mesos/pull/563#discussion_r1571502311
########## src/linux/cgroups2.hpp: ########## @@ -241,6 +243,48 @@ Try<BandwidthLimit> max(const std::string& cgroup); // See: https://docs.kernel.org/admin-guide/cgroup-v2.html namespace memory { +// Cgroup memory controller events. +// +// Snapshot of the 'memory.events' or 'memory.local.events' control files. +struct Events +{ + // Number of times memory is reclaimed from the cgroup despite being under + // the low memory threshold. Usually indicates that the low threshold is too + // high. Review Comment: low threshold is too high -> low boundaries are over-committed come to think of it, let's just use the cgroups v2 explanations since they are pretty short? ########## src/tests/containerizer/cgroups2_tests.cpp: ########## @@ -484,6 +489,46 @@ TEST_F(Cgroups2Test, ROOT_CGROUPS2_GetCgroups) } +TEST_F(Cgroups2Test, ROOT_CGROUPS2_OomDetection) +{ + // Check that exceeding the hard memory limit will trigger an OOM event. + // + // We set a hard memory limit on the test cgroup, move a process inside of + // the test cgroup subtree, listen for an OOM event, deliberately trigger an + // OOM event by exceeding the hard limit, and then check that an event was + // triggered. + ASSERT_SOME(enable_controllers({"memory"})); + + ASSERT_SOME(cgroups2::create(TEST_CGROUP)); + ASSERT_SOME(cgroups2::controllers::enable(TEST_CGROUP, {"memory"})); + + const string leaf_cgroup = TEST_CGROUP + "/leaf"; + ASSERT_SOME(cgroups2::create(leaf_cgroup)); + + Try<os::Memory> memory = os::memory(); + ASSERT_SOME(memory); Review Comment: not needed anymore? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
