summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMichal Koutný <mkoutny@suse.com>2021-12-10 17:44:19 +0100
committerMichal Koutný <mkoutny@suse.com>2022-01-10 18:22:27 +0100
commitd43ffcac84400e539f54323fe6a4125022d4ffe3 (patch)
tree7257ca470511faa4ba00f713c5256afcd6f56930 /src/core
parentMerge pull request #22071 from keszybz/xdg-autostart-logs (diff)
downloadsystemd-d43ffcac84400e539f54323fe6a4125022d4ffe3.tar.xz
systemd-d43ffcac84400e539f54323fe6a4125022d4ffe3.zip
core/cgroup: Provide information about applied BFQ scaling
The BFQ weights are not passed verbatim to the kernel, provide that information in a form of debug message so that users are not surprised/confused when IOWeight != io.bfq.weight.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/cgroup.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index f58de95a49..07d53b2fb6 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -1279,6 +1279,7 @@ assert_cc(BFQ_WEIGHT(10000) == 1000);
static void set_io_weight(Unit *u, uint64_t weight) {
char buf[STRLEN("default \n")+DECIMAL_STR_MAX(uint64_t)];
+ uint64_t bfq_weight;
assert(u);
@@ -1286,8 +1287,11 @@ static void set_io_weight(Unit *u, uint64_t weight) {
* See also: https://github.com/systemd/systemd/pull/13335 and
* https://github.com/torvalds/linux/commit/65752aef0a407e1ef17ec78a7fc31ba4e0b360f9.
* The range is 1..1000 apparently, and the default is 100. */
- xsprintf(buf, "%" PRIu64 "\n", BFQ_WEIGHT(weight));
- (void) set_attribute_and_warn(u, "io", "io.bfq.weight", buf);
+ bfq_weight = BFQ_WEIGHT(weight);
+ xsprintf(buf, "%" PRIu64 "\n", bfq_weight);
+ if (set_attribute_and_warn(u, "io", "io.bfq.weight", buf) >= 0 && weight != bfq_weight)
+ log_unit_debug(u, "IOWeight=%" PRIu64 " scaled to io.bfq.weight=%" PRIu64,
+ weight, bfq_weight);
xsprintf(buf, "default %" PRIu64 "\n", weight);
(void) set_attribute_and_warn(u, "io", "io.weight", buf);
@@ -1295,12 +1299,16 @@ static void set_io_weight(Unit *u, uint64_t weight) {
static void set_blkio_weight(Unit *u, uint64_t weight) {
char buf[STRLEN("\n")+DECIMAL_STR_MAX(uint64_t)];
+ uint64_t bfq_weight;
assert(u);
/* FIXME: see comment in set_io_weight(). */
- xsprintf(buf, "%" PRIu64 "\n", BFQ_WEIGHT(weight));
- (void) set_attribute_and_warn(u, "blkio", "blkio.bfq.weight", buf);
+ bfq_weight = BFQ_WEIGHT(weight);
+ xsprintf(buf, "%" PRIu64 "\n", bfq_weight);
+ if (set_attribute_and_warn(u, "blkio", "blkio.bfq.weight", buf) >= 0 && weight != bfq_weight)
+ log_unit_debug(u, "BlockIOWeight=%" PRIu64 " scaled to blkio.bfq.weight=%" PRIu64,
+ weight, bfq_weight);
xsprintf(buf, "%" PRIu64 "\n", weight);
(void) set_attribute_and_warn(u, "blkio", "blkio.weight", buf);