core/cgroup: always submit unit to realize queue if all controllers are being invalidated (#38194)

This commit is contained in:
Daan De Meyer
2025-07-14 15:07:16 +02:00
committed by GitHub
2 changed files with 7 additions and 4 deletions
+6 -3
View File
@@ -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;
@@ -4380,8 +4384,7 @@ int cgroup_runtime_deserialize_one(Unit *u, const char *key, const char *value,
if (!UNIT_HAS_CGROUP_CONTEXT(u))
return 0;
if (MATCH_DESERIALIZE_IMMEDIATE(u, "cpu-usage-base", key, value, safe_atou64, cpu_usage_base) ||
MATCH_DESERIALIZE_IMMEDIATE(u, "cpuacct-usage-base", key, value, safe_atou64, cpu_usage_base))
if (MATCH_DESERIALIZE_IMMEDIATE(u, "cpu-usage-base", key, value, safe_atou64, cpu_usage_base))
return 1;
if (MATCH_DESERIALIZE_IMMEDIATE(u, "cpu-usage-last", key, value, safe_atou64, cpu_usage_last))
+1 -1
View File
@@ -5552,7 +5552,7 @@ int exec_invoke(
* memory_pressure_path != NULL in the conditional below. */
if (memory_pressure_path && needs_sandboxing && exec_needs_cgroup_namespace(context)) {
memory_pressure_path = mfree(memory_pressure_path);
r = cg_get_path("memory", "", "memory.pressure", &memory_pressure_path);
r = cg_get_path("memory", "/", "memory.pressure", &memory_pressure_path);
if (r < 0) {
*exit_status = EXIT_MEMORY;
return log_oom();