]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemd: Default to OOMPolicy=continue for login session scopes 25385/head
authorMark Laws <mdl@60hz.org>
Thu, 24 Nov 2022 05:56:29 +0000 (14:56 +0900)
committerMark Laws <mdl@60hz.org>
Thu, 24 Nov 2022 10:41:36 +0000 (19:41 +0900)
If the kernel OOM kills a process under a login session scope, we don't want to
kill the user's other processes for no good reason.

src/login/logind-dbus.c

index 86a5decf3f3106ec7e5a3358d7b60e8bc8b25c72..2ab26b9c6d4b9280dd7ea29034913fb5d20f526a 100644 (file)
@@ -3970,6 +3970,12 @@ int manager_start_scope(
         if (r < 0)
                 return r;
 
+        /* For login session scopes, if a process is OOM killed by the kernel, *don't* terminate the rest of
+           the scope */
+        r = sd_bus_message_append(m, "(sv)", "OOMPolicy", "s", "continue");
+        if (r < 0)
+                return r;
+
         /* disable TasksMax= for the session scope, rely on the slice setting for it */
         r = sd_bus_message_append(m, "(sv)", "TasksMax", "t", UINT64_MAX);
         if (r < 0)