daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
21255d
From af9f03ba48dd75be8c6a923f70da9804b3a3a2c3 Mon Sep 17 00:00:00 2001
21255d
From: Pavel Hrdina <phrdina@redhat.com>
21255d
Date: Wed, 25 Nov 2020 09:05:36 +0100
21255d
Subject: [PATCH] cgroup: Also set blkio.bfq.weight
21255d
21255d
Commit [1] added a workaround when unified cgroups are used but missed
21255d
legacy cgroups where there is the same issue.
21255d
21255d
[1] <https://github.com/systemd/systemd/commit/2dbc45aea747f25cc1c3848fded2ec0062f96bcf>
21255d
21255d
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
21255d
(cherry picked from commit 35e7a62ca32a30169a94693b831e53c832251984)
21255d
21255d
Resolves: #1657810
21255d
---
21255d
 src/core/cgroup.c | 8 ++++++++
21255d
 1 file changed, 8 insertions(+)
21255d
21255d
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
21255d
index f1ce070f9a..71e30fd4db 100644
21255d
--- a/src/core/cgroup.c
21255d
+++ b/src/core/cgroup.c
21255d
@@ -1063,6 +1063,14 @@ static void cgroup_context_apply(
21255d
                                 log_unit_full(u, IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
21255d
                                               "Failed to set blkio.weight: %m");
21255d
 
21255d
+                        /* FIXME: drop this when distro kernels properly support BFQ through "blkio.weight"
21255d
+                         * See also: https://github.com/systemd/systemd/pull/13335 */
21255d
+                        xsprintf(buf, "%" PRIu64 "\n", weight);
21255d
+                        r = cg_set_attribute("blkio", path, "blkio.bfq.weight", buf);
21255d
+                        if (r < 0)
21255d
+                                log_unit_full(u, IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
21255d
+                                              "Failed to set blkio.bfq.weight: %m");
21255d
+
21255d
                         if (has_io) {
21255d
                                 CGroupIODeviceWeight *w;
21255d