Skip to content

Commit

Permalink
systemd: Default to OOMPolicy=continue for login session scopes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
drvink committed Nov 24, 2022
1 parent 5fa0983 commit 98b6c94
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/login/logind-dbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 98b6c94

Please sign in to comment.