From d57fdbb5e29dbec320eb755e5512ba57033ddbc7 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Mon, 19 Jan 2026 02:05:33 +0100 Subject: [PATCH] core/cgroup: do not consider cgroup_context_has_io_config() if only IOAccounting=yes This makes things in line with unit_has_memory_config(), and suppresses pointless application of IO configs. --- src/core/cgroup.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/cgroup.c b/src/core/cgroup.c index c4336cd80e..6519440e45 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -1150,8 +1150,9 @@ static void cgroup_apply_cpuset(Unit *u, const CPUSet *cpus, const char *name) { } static bool cgroup_context_has_io_config(CGroupContext *c) { - return c->io_accounting || - c->io_weight != CGROUP_WEIGHT_INVALID || + assert(c); + + return c->io_weight != CGROUP_WEIGHT_INVALID || c->startup_io_weight != CGROUP_WEIGHT_INVALID || c->io_device_weights || c->io_device_latencies || @@ -1691,7 +1692,8 @@ static CGroupMask unit_get_cgroup_mask(Unit *u) { if (cgroup_context_has_allowed_cpus(c) || cgroup_context_has_allowed_mems(c)) mask |= CGROUP_MASK_CPUSET; - if (cgroup_context_has_io_config(c)) + if (c->io_accounting || + cgroup_context_has_io_config(c)) mask |= CGROUP_MASK_IO; if (c->memory_accounting ||