ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
df98bb
From 4e589237979fdf90af38d466abd7fcd852356f02 Mon Sep 17 00:00:00 2001
df98bb
From: Kai Krakow <kai@kaishome.de>
df98bb
Date: Sat, 17 Aug 2019 02:33:43 +0200
df98bb
Subject: [PATCH] cgroup: Also set io.bfq.weight
df98bb
df98bb
Current kernels with BFQ scheduler do not yet set their IO weight
df98bb
through "io.weight" but through "io.bfq.weight" (using a slightly
df98bb
different interface supporting only default weights, not per-device
df98bb
weights). This commit enables "IOWeight=" to just to that.
df98bb
df98bb
This patch may be dropped at some time later.
df98bb
df98bb
Github-Link: https://github.com/systemd/systemd/issues/7057
df98bb
Signed-off-by: Kai Krakow <kai@kaishome.de>
df98bb
df98bb
(cherry picked from commit 21221ce1ce9a572e82d46d80692afd65c224fc50)
df98bb
df98bb
Related: #1927290
df98bb
---
df98bb
 src/core/cgroup.c | 8 ++++++++
df98bb
 1 file changed, 8 insertions(+)
df98bb
df98bb
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
df98bb
index 71e30fd4db..f02cc31c6e 100644
df98bb
--- a/src/core/cgroup.c
df98bb
+++ b/src/core/cgroup.c
df98bb
@@ -984,6 +984,14 @@ static void cgroup_context_apply(
df98bb
                                 log_unit_full(u, IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
df98bb
                                               "Failed to set io.weight: %m");
df98bb
 
df98bb
+                        /* FIXME: drop this when distro kernels properly support BFQ through "io.weight"
df98bb
+                         * See also: https://github.com/systemd/systemd/pull/13335 */
df98bb
+                        xsprintf(buf, "%" PRIu64 "\n", weight);
df98bb
+                        r = cg_set_attribute("io", path, "io.bfq.weight", buf);
df98bb
+                        if (r < 0)
df98bb
+                                log_unit_full(u, IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
df98bb
+                                              "Failed to set io.bfq.weight: %m");
df98bb
+
df98bb
                         if (has_io) {
df98bb
                                 CGroupIODeviceWeight *w;
df98bb