summaryrefslogtreecommitdiff
path: root/src/core/cgroup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-02-15 11:22:02 +0100
committerLennart Poettering <lennart@poettering.net>2023-03-01 09:43:23 +0100
commit29e6b0c171f49edb05e017a80bc90a61dfe82de0 (patch)
tree618e598795e9e36d5cb262bd2451b63db3557229 /src/core/cgroup.c
parentee32689f39d7a0bf3cec09aa729ccc61aa0bd10f (diff)
downloadsystemd-29e6b0c171f49edb05e017a80bc90a61dfe82de0.tar.gz
pid1: also process memory pressure events (and SIGRTMIN+18)
Diffstat (limited to 'src/core/cgroup.c')
-rw-r--r--src/core/cgroup.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 7ac9549f89..441d1125d2 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -2362,6 +2362,13 @@ static int unit_update_cgroup(
cgroup_context_apply(u, target_mask, state);
cgroup_xattr_apply(u);
+ /* For most units we expect that memory monitoring is set up before the unit is started and we won't
+ * touch it after. For PID 1 this is different though, because we couldn't possibly do that given
+ * that PID 1 runs before init.scope is even set up. Hence, whenever init.scope is realized, let's
+ * try to open the memory pressure interface anew. */
+ if (unit_has_name(u, SPECIAL_INIT_SCOPE))
+ (void) manager_setup_memory_pressure_event_source(u->manager);
+
return 0;
}