diff --git a/backport-revert-core-map-io.bfq.weight-to-1.1000.patch b/backport-revert-core-map-io.bfq.weight-to-1.1000.patch new file mode 100644 index 0000000000000000000000000000000000000000..8f6b4cd6c0e9f582a3b57efc81460659f88564ba --- /dev/null +++ b/backport-revert-core-map-io.bfq.weight-to-1.1000.patch @@ -0,0 +1,90 @@ +From 04bee6cd5439a4efb0faaf56ea245d44f3e99781 Mon Sep 17 00:00:00 2001 +From: y30009332 +Date: Tue, 1 Mar 2022 16:54:46 +0800 +Subject: [PATCH] revert :core map io.bfq.weight to 1..1000 +Reason:systemd-248 map io.bfq.weight to 1..1000, example 600 map to 60, +In order to maintain compatibility with v243, revert the commit and use +the v243 scheme + +Reference:https://github.com/systemd/systemd/commit/68c1ac1568910037a224c301d5c871af73493c16 +--- + src/core/cgroup.c | 35 ++++++++++++++++------------------- + 1 file changed, 16 insertions(+), 19 deletions(-) + +diff --git a/src/core/cgroup.c b/src/core/cgroup.c +index 2cbb789978..e5c4a605a6 100644 +--- a/src/core/cgroup.c ++++ b/src/core/cgroup.c +@@ -1194,23 +1194,6 @@ static int cgroup_apply_devices(Unit *u) { + return r; + } + +-static void set_io_weight(Unit *u, const char *controller, uint64_t weight) { +- char buf[8+DECIMAL_STR_MAX(uint64_t)+1]; +- const char *p; +- +- p = strjoina(controller, ".weight"); +- xsprintf(buf, "default %" PRIu64 "\n", weight); +- (void) set_attribute_and_warn(u, controller, p, buf); +- +- /* FIXME: drop this when distro kernels properly support BFQ through "io.weight" +- * See also: https://github.com/systemd/systemd/pull/13335 and +- * https://github.com/torvalds/linux/commit/65752aef0a407e1ef17ec78a7fc31ba4e0b360f9. +- * The range is 1..1000 apparently. */ +- p = strjoina(controller, ".bfq.weight"); +- xsprintf(buf, "%" PRIu64 "\n", (weight + 9) / 10); +- (void) set_attribute_and_warn(u, controller, p, buf); +-} +- + static void cgroup_apply_bpf_foreign_program(Unit *u) { + assert(u); + +@@ -1303,6 +1286,7 @@ static void cgroup_context_apply( + * controller), and in case of containers we want to leave control of these attributes to the container manager + * (and we couldn't access that stuff anyway, even if we tried if proper delegation is used). */ + if ((apply_mask & CGROUP_MASK_IO) && !is_local_root) { ++ char buf[8+DECIMAL_STR_MAX(uint64_t)+1]; + bool has_io, has_blockio; + uint64_t weight; + +@@ -1322,7 +1306,13 @@ static void cgroup_context_apply( + } else + weight = CGROUP_WEIGHT_DEFAULT; + +- set_io_weight(u, "io", weight); ++ xsprintf(buf, "default %" PRIu64 "\n", weight); ++ (void) set_attribute_and_warn(u, "io", "io.weight", buf); ++ ++ /* FIXME: drop this when distro kernels properly support BFQ through "io.weight" ++ * See also: https://github.com/systemd/systemd/pull/13335 */ ++ xsprintf(buf, "%" PRIu64 "\n", weight); ++ (void) set_attribute_and_warn(u, "io", "io.bfq.weight", buf); + + if (has_io) { + CGroupIODeviceLatency *latency; +@@ -1377,6 +1367,7 @@ static void cgroup_context_apply( + /* Applying a 'weight' never makes sense for the host root cgroup, and for containers this should be + * left to our container manager, too. */ + if (!is_local_root) { ++ char buf[DECIMAL_STR_MAX(uint64_t)+1]; + uint64_t weight; + + if (has_io) { +@@ -1392,7 +1383,13 @@ static void cgroup_context_apply( + else + weight = CGROUP_BLKIO_WEIGHT_DEFAULT; + +- set_io_weight(u, "blkio", weight); ++ xsprintf(buf, "%" PRIu64 "\n", weight); ++ (void) set_attribute_and_warn(u, "blkio", "blkio.weight", buf); ++ ++ /* FIXME: drop this when distro kernels properly support BFQ through "blkio.weight" ++ * See also: https://github.com/systemd/systemd/pull/13335 */ ++ xsprintf(buf, "%" PRIu64 "\n", weight); ++ (void) set_attribute_and_warn(u, "blkio", "blkio.bfq.weight", buf); + + if (has_io) { + CGroupIODeviceWeight *w; +-- +2.27.0 + diff --git a/systemd.spec b/systemd.spec index da0c87edcaa4954d540b7c38607e125ac74e3fd0..7813dcb28c726859c6bdf53d84bad67c4228fd99 100644 --- a/systemd.spec +++ b/systemd.spec @@ -20,7 +20,7 @@ Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd Version: 249 -Release: 9 +Release: 10 License: MIT and LGPLv2+ and GPLv2+ Summary: System and Service Manager @@ -78,6 +78,7 @@ Patch6008: backport-CVE-2021-3997-shared-rm_rf-refactor-rm_rf-to-shorten-co Patch6009: backport-CVE-2021-3997-shared-rm-rf-loop-over-nested-directories-instead-of.patch Patch6010: backport-fix-CVE-2021-33910.patch Patch6011: backport-temporarily-disable-test-seccomp.patch +Patch6012: backport-revert-core-map-io.bfq.weight-to-1.1000.patch BuildRequires: gcc, gcc-c++ BuildRequires: libcap-devel, libmount-devel, pam-devel, libselinux-devel @@ -1699,6 +1700,9 @@ fi %{_unitdir}/systemd-userdbd.socket %changelog +* Tue Mar 1 2022 yangmingtai - 249-10 +- revert :core map io.bfq.weight to 1..1000 + * Tue Mar 1 2022 duyiwei - 249-9 - change %systemd_requires to %{?systemd_requires}