daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
c2dfb7
From 8e1cc941607263a4f8454d0d6d5939aec3be1fcb Mon Sep 17 00:00:00 2001
c2dfb7
From: David Tardon <dtardon@redhat.com>
c2dfb7
Date: Tue, 23 Jun 2020 13:58:21 +0200
c2dfb7
Subject: [PATCH] fix mis-merge
c2dfb7
c2dfb7
Resolves: #1848421
c2dfb7
---
c2dfb7
 src/core/cgroup.c | 4 +++-
c2dfb7
 1 file changed, 3 insertions(+), 1 deletion(-)
c2dfb7
c2dfb7
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
c2dfb7
index 2d819b8ebb..e0eb184fd2 100644
c2dfb7
--- a/src/core/cgroup.c
c2dfb7
+++ b/src/core/cgroup.c
c2dfb7
@@ -664,11 +664,13 @@ static void cgroup_apply_legacy_cpu_config(Unit *u, uint64_t shares, uint64_t qu
c2dfb7
 
c2dfb7
         if (quota != USEC_INFINITY) {
c2dfb7
                 xsprintf(buf, USEC_FMT "\n", MAX(quota * period / USEC_PER_SEC, USEC_PER_MSEC));
c2dfb7
+                r = cg_set_attribute("cpu", u->cgroup_path, "cpu.cfs_quota_us", buf);
c2dfb7
+        }
c2dfb7
+        else
c2dfb7
                 r = cg_set_attribute("cpu", u->cgroup_path, "cpu.cfs_quota_us", "-1");
c2dfb7
         if (r < 0)
c2dfb7
                 log_unit_full(u, IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
c2dfb7
                               "Failed to set cpu.cfs_quota_us: %m");
c2dfb7
-        }
c2dfb7
 }
c2dfb7
 
c2dfb7
 static uint64_t cgroup_cpu_shares_to_weight(uint64_t shares) {