core: add a new setting DefaultOOMScoreAdjust= and set it to 100 above service manager's by default

Let's make our service managers slightly less likely to be killed by the
OOM killer by adjusting our services' OOM score adjustment to 100 above
ours. Do this conservatively, i.e. only for regular user sessions.
This commit is contained in:
Lennart Poettering
2021-10-04 16:27:10 +02:00
parent bb2d1d8ea4
commit d4a402e4f6
5 changed files with 113 additions and 1 deletions
+5
View File
@@ -187,6 +187,11 @@ static void unit_init(Unit *u) {
if (ec) {
exec_context_init(ec);
if (u->manager->default_oom_score_adjust_set) {
ec->oom_score_adjust = u->manager->default_oom_score_adjust;
ec->oom_score_adjust_set = true;
}
if (MANAGER_IS_SYSTEM(u->manager))
ec->keyring_mode = EXEC_KEYRING_SHARED;
else {