bmahler commented on code in PR #539:
URL: https://github.com/apache/mesos/pull/539#discussion_r1544738920


##########
src/slave/containerizer/mesos/containerizer.cpp:
##########
@@ -116,6 +116,13 @@
 #include "slave/containerizer/mesos/isolators/volume/image.hpp"
 #include "slave/containerizer/mesos/isolators/volume/secret.hpp"
 #include "slave/containerizer/mesos/isolators/volume/csi/isolator.hpp"
+
+#ifdef ENABLE_CGROUPS_V2
+#include "linux/cgroups2.hpp"
+
+#include "slave/containerizer/mesos/isolators/cgroups2/cgroups2.hpp"
+#endif

Review Comment:
   // ENABLE_CGROUPS_V2



##########
src/slave/main.cpp:
##########
@@ -147,6 +154,146 @@ const char* malloc_conf = "narenas:4";
 
 
 #ifdef __linux__
+
+#ifdef ENABLE_CGROUPS_V2
+// Log any processes inside of a cgroup.
+static Try<Nothing> logProcesses(const string& cgroup)
+{
+  Try<set<pid_t>> processes = cgroups2::processes(cgroup);
+  if (processes.isError()) {
+    return Error(
+        "Failed to check for existing processes in cgroup '" + cgroup + "': "
+        + processes.error());
+  }
+
+  if (!processes->empty()) {
+    vector<string> infos;
+    foreach (pid_t pid, *processes) {
+      Result<os::Process> proc = os::process(pid);
+
+      // Print the command if it's available.
+      if (proc.isSome()) {
+        infos.push_back(stringify(pid) + " '" + proc->command + "'");
+      } else {
+        infos.push_back(stringify(pid));
+      }
+    }
+
+    LOG(INFO) << "Found process(es) in the cgroup '" << cgroup << "'. "
+              << "Consider checking the following process(es) listed in "
+              << path::join("/sys/fs/cgroup", cgroup, "cgroup.procs")
+              << ":\n" << strings::join("\n", infos);
+  }
+
+  return Nothing();
+}
+// Initialize Mesos cgroups for cgroups v2.

Review Comment:
   double newline here



-- 
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]

Reply via email to