diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 7f3782ae41..4cac3f6a89 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -2528,7 +2528,7 @@ static bool unit_has_mask_enables_realized( ((u->cgroup_enabled_mask | enable_mask) & CGROUP_MASK_V2) == (u->cgroup_enabled_mask & CGROUP_MASK_V2); } -static void unit_add_to_cgroup_realize_queue(Unit *u) { +void unit_add_to_cgroup_realize_queue(Unit *u) { assert(u); if (u->in_cgroup_realize_queue) diff --git a/src/core/cgroup.h b/src/core/cgroup.h index a6a3d186ac..d137e3af4f 100644 --- a/src/core/cgroup.h +++ b/src/core/cgroup.h @@ -264,6 +264,7 @@ int unit_realize_cgroup(Unit *u); void unit_prune_cgroup(Unit *u); int unit_watch_cgroup(Unit *u); int unit_watch_cgroup_memory(Unit *u); +void unit_add_to_cgroup_realize_queue(Unit *u); void unit_release_cgroup(Unit *u); /* Releases the cgroup only if it is recursively empty. diff --git a/src/core/scope.c b/src/core/scope.c index e2fc4cc995..914d1cc744 100644 --- a/src/core/scope.c +++ b/src/core/scope.c @@ -789,6 +789,10 @@ static void scope_enumerate_perpetual(Manager *m) { unit_add_to_load_queue(u); unit_add_to_dbus_queue(u); + /* Enqueue an explicit cgroup realization here. Unlike other cgroups this one already exists and is + * populated (by us, after all!) already, even when we are not in a reload cycle. Hence we cannot + * apply the settings at creation time anymore, but let's at least apply them asynchronously. */ + unit_add_to_cgroup_realize_queue(u); } static const char* const scope_result_table[_SCOPE_RESULT_MAX] = { diff --git a/test/TEST-55-OOMD/test.sh b/test/TEST-55-OOMD/test.sh index 4dc414294c..4032896061 100755 --- a/test/TEST-55-OOMD/test.sh +++ b/test/TEST-55-OOMD/test.sh @@ -16,6 +16,12 @@ test_append_files() { cat >>"${initdir:?}/etc/fstab" <>"${initdir:?}/etc/systemd/system/init.scope.d/test-55-oomd.conf" <>/skipped cgroup_type="$(stat -fc %T /sys/fs/cgroup/)"