From e0d3213e09a97ec2bbf0dd2a6dfe58f08f6cb5d5 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Sat, 12 Jul 2025 17:39:14 +0200 Subject: [PATCH] core/cgroup: always submit unit to realize queue if all controllers are being invalidated Alternative to #38190 Fixes #38112 --- src/core/cgroup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/cgroup.c b/src/core/cgroup.c index c2f6f47e6e0..980d9b0f0ba 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -3950,7 +3950,11 @@ bool unit_invalidate_cgroup(Unit *u, CGroupMask m) { if (!crt) return false; - if (FLAGS_SET(crt->cgroup_invalidated_mask, m)) /* NOP? */ + /* If all controllers shall be invalidated, let's unconditionally submit the unit to realize queue. + * We initialize the field to _CGROUP_MASK_ALL after all, and semantically it makes sense to use + * it as a special signal to forcibly re-realize cgroup. */ + if (m != _CGROUP_MASK_ALL && + FLAGS_SET(crt->cgroup_invalidated_mask, m)) /* NOP? */ return false; crt->cgroup_invalidated_mask |= m; -- 2.47.3