This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 774886936 [cgroups2] Register core controller in container info.
774886936 is described below

commit 77488693688eab16941c6807af02dafdac25dbcc
Author: Jason Zhou <[email protected]>
AuthorDate: Fri Aug 9 18:04:09 2024 -0400

    [cgroups2] Register core controller in container info.
    
    Currently the core controller is skipped over during prepare(),
    and it is not added to the container's registered controlelrs.
    
    We need to register the core controller so that its functions can be
    called by the isolator.
    
    Review: https://reviews.apache.org/r/75159/
---
 .../mesos/isolators/cgroups2/cgroups2.cpp           | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp 
b/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
index 55cc759a3..4174be0fa 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
@@ -228,28 +228,15 @@ Future<Option<ContainerLaunchInfo>> 
Cgroups2IsolatorProcess::prepare(
       new Info(containerId, nonLeafCgroup, leafCgroup));
 
   vector<Future<Nothing>> prepares;
+  hashset<string> skip_enable = {"core", "perf_event", "devices"};
   foreachvalue (const Owned<Controller>& controller, controllers) {
-    if (controller->name() == "core") {
-      // The "core" controller is always enabled because the "cgroup.*" control
-      // files exist for all cgroups.
-      //
-      // Additionally, since "core", "perf_event", and "devices" aren't valid
-      // controller names (i.e. they don't exist in "cgroup.controllers"),
-      // calling `cgroups2::controllers::enable` with these cgroups will fail
-      // with "Invalid argument".
-      //
-      // Therefore, we skip enabling the "core", "perf_event", and "devices"
-      // controller here.
-      continue;
-    }
-
-    // Similar to "core", "perf_event" and "devices" do not exist in
-    // cgroup.controllers, and therefore we cannot call
+    // The "core", "perf_event" and "devices" controllers do not exist in
+    // cgroup.controllers file, and therefore we cannot call
     // cgroups2::controllers::enable with it as it cannot be written into
     // cgroup.subtree_control, but we still need to push it into the 
controllers
     // of the containers, so we will only skip the call for
     // cgroups2::controllers::enable.
-    if (controller->name() != "perf_event" && controller->name() != "devices") 
{
+    if (!skip_enable.contains(controller->name())) {
       Try<Nothing> enable =
         cgroups2::controllers::enable(nonLeafCgroup, {controller->name()});
       if (enable.isError()) {

Reply via email to