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.
This commit is contained in:
Mike Yuan
2026-01-19 13:33:28 +01:00
parent 8292b859f3
commit d57fdbb5e2
+5 -3
View File
@@ -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 ||