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 d9c584c7e [cgroups2] Ignore manual enabling of perf_event during
prepare phase.
d9c584c7e is described below
commit d9c584c7e92cdd3e9dee84cb8aa47b0ade3c5048
Author: None <None>
AuthorDate: Tue May 21 00:41:41 2024 -0400
[cgroups2] Ignore manual enabling of perf_event during prepare phase.
In Cgroups2IsolatorProcess::prepare, it may manually enable controller
by writing to the cgroup.subtree_control process.
For perf_event, since is is automatically turned on, it does not appear
inside the cgroup.controllers file and hence cannot be written to the
cgroup.subtree_control file. For this reason, we skip the enable call for
the perf_event controller.
Review: https://reviews.apache.org/r/74998/
---
.../mesos/isolators/cgroups2/cgroups2.cpp | 29 ++++++++++++++--------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
b/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
index cd9c38d9d..2ca388079 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
@@ -209,20 +209,29 @@ Future<Option<ContainerLaunchInfo>>
Cgroups2IsolatorProcess::prepare(
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" isn't a
- // valid controller name (i.e. it doesn't exist in "cgroup.controllers"),
- // calling `cgroups2::controllers::enable` with the "core" cgroup will
- // fail with "Invalid argument".
+ // files exist for all cgroups.
//
- // For that reason, we skip enabling the "core" controller here.
+ // 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".
+ //
+ // Therefore, we skip enabling the "core" and "perf_event" controller
here.
continue;
}
- Try<Nothing> enable =
- cgroups2::controllers::enable(nonLeafCgroup, {controller->name()});
- if (enable.isError()) {
- return Failure("Failed to enable controller '" + controller->name() + "'"
- " in cgroup '" + nonLeafCgroup + "': " + enable.error());
+ // 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") {
+ Try<Nothing> enable =
+ cgroups2::controllers::enable(nonLeafCgroup, {controller->name()});
+ if (enable.isError()) {
+ return Failure("Failed to enable controller '" + controller->name() +
"'"
+ " in cgroup '" + nonLeafCgroup + "': " +
enable.error());
+ }
}
// We don't enable the controllers in the leaf cgroup because of the