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

commit 5bed66c009a5b3c5670e3b7a5c0adae87b58417a
Author: Jason Zhou <[email protected]>
AuthorDate: Wed Jul 31 15:53:15 2024 -0700

    [cgroups2] Skip enabling of devices controller.
    
    Similar to the `perf_event` controller, the `devices` controller cannot
    be written into cgroup.subtree_control file, so we skip the call to
    cgroups2::controllers::enable for the device controller. Otherwise
    we will run into an "Invalid argument" error from cgroups.
    
    Review: https://reviews.apache.org/r/75130/
---
 .../mesos/isolators/cgroups2/cgroups2.cpp          | 24 ++++++++++++----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp 
b/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
index 5e2856437..a027ee632 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
@@ -225,21 +225,23 @@ Future<Option<ContainerLaunchInfo>> 
Cgroups2IsolatorProcess::prepare(
       // The "core" controller is always enabled because the "cgroup.*" control
       // files exist for all cgroups.
       //
-      // Additionally, since "core" and "perf_event" 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".
+      // 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" and "perf_event" controller 
here.
+      // Therefore, we skip enabling the "core", "perf_event", and "devices"
+      // controller here.
       continue;
     }
 
-    // Similar to "core", "perf_event" does not exist in cgroup.controllers,
-    // 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") {
+    // Similar to "core", "perf_event" and "devices" do not exist in
+    // cgroup.controllers, 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") 
{
       Try<Nothing> enable =
         cgroups2::controllers::enable(nonLeafCgroup, {controller->name()});
       if (enable.isError()) {

Reply via email to