dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
b9a53a
From 5fc2d94fbf8271bb340e834f832af5d890c267bf Mon Sep 17 00:00:00 2001
b9a53a
From: =?UTF-8?q?Michal=20Sekleta=CC=81r?= <msekleta@redhat.com>
b9a53a
Date: Tue, 3 Mar 2020 11:45:00 +0100
be3800
Subject: [PATCH] cgroup: make sure that cpuset is supported on cgroup v2 and
be3800
 disabled with v1
b9a53a
b9a53a
Resolves: #1808940
b9a53a
b9a53a
(rhel-only)
b9a53a
---
b9a53a
 src/basic/cgroup-util.c | 7 +++++--
b9a53a
 1 file changed, 5 insertions(+), 2 deletions(-)
b9a53a
b9a53a
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
b9a53a
index 6f47c3aacb..92bc1f2543 100644
b9a53a
--- a/src/basic/cgroup-util.c
b9a53a
+++ b/src/basic/cgroup-util.c
b9a53a
@@ -2353,10 +2353,10 @@ int cg_mask_supported(CGroupMask *ret) {
b9a53a
                 if (r < 0)
b9a53a
                         return r;
b9a53a
 
b9a53a
-                /* Currently, we support the cpu, memory, io and pids
b9a53a
+                /* Currently, we support the cpu, memory, io, pids and cpuset
b9a53a
                  * controller in the unified hierarchy, mask
b9a53a
                  * everything else off. */
b9a53a
-                mask &= CGROUP_MASK_CPU | CGROUP_MASK_MEMORY | CGROUP_MASK_IO | CGROUP_MASK_PIDS;
b9a53a
+                mask &= CGROUP_MASK_CPU | CGROUP_MASK_MEMORY | CGROUP_MASK_IO | CGROUP_MASK_PIDS | CGROUP_MASK_CPUSET;
b9a53a
 
b9a53a
         } else {
b9a53a
                 CGroupController c;
b9a53a
@@ -2367,6 +2367,9 @@ int cg_mask_supported(CGroupMask *ret) {
b9a53a
                 for (c = 0; c < _CGROUP_CONTROLLER_MAX; c++) {
b9a53a
                         const char *n;
b9a53a
 
b9a53a
+                        if (c == CGROUP_CONTROLLER_CPUSET)
b9a53a
+                                continue;
b9a53a
+
b9a53a
                         n = cgroup_controller_to_string(c);
b9a53a
                         if (controller_is_accessible(n) >= 0)
b9a53a
                                 mask |= CGROUP_CONTROLLER_TO_MASK(c);