summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-08-22 10:02:28 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-08-22 10:02:28 +0200
commit2ec71e439f62603de29e68e48705c1f707b847db (patch)
treea51c35279bdfae87b6296fa659ade558dcf6a2fe
parentd0696f3b7501744d91bcbef83478b9cd4a8160f4 (diff)
downloadsystemd-2ec71e439f62603de29e68e48705c1f707b847db.tar.gz
journald: slightly bump OOM adjust for journald (#13366)
If logging disappears issues are hard to debug, hence let's give journald a slight edge over other services when the OOM killer hits. Here are the special adjustments we now make: systemd-coredump@.service.in OOMScoreAdjust=500 systemd-journald.service.in OOMScoreAdjust=-250 systemd-udevd.service.in OOMScoreAdjust=-1000 (i.e. the coredump processing is made more likely to be killed on OOM, and udevd and journald are less likely to be killed)
-rw-r--r--TODO2
-rw-r--r--src/shutdown/shutdown.c1
-rw-r--r--units/systemd-journald.service.in1
-rw-r--r--units/systemd-udevd.service.in1
4 files changed, 2 insertions, 3 deletions
diff --git a/TODO b/TODO
index 78189ce5e9..c5b5b86057 100644
--- a/TODO
+++ b/TODO
@@ -23,8 +23,6 @@ Features:
may be used to mark a whole binary as non-coredumpable. Would fix:
https://bugs.freedesktop.org/show_bug.cgi?id=69447
-* adjust OOM score slightly for journald
-
* beef up hibernation to optionally do swapon/swapoff immediately before/after
the hibernation
diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c
index a574a07041..0eb17989d0 100644
--- a/src/shutdown/shutdown.c
+++ b/src/shutdown/shutdown.c
@@ -508,7 +508,6 @@ int main(int argc, char *argv[]) {
log_error_errno(errno, "Failed to execute shutdown binary: %m");
} else
log_error_errno(r, "Failed to switch root to \"/run/initramfs\": %m");
-
}
if (need_umount || need_swapoff || need_loop_detach || need_dm_detach)
diff --git a/units/systemd-journald.service.in b/units/systemd-journald.service.in
index 323334f6a3..089bc38f59 100644
--- a/units/systemd-journald.service.in
+++ b/units/systemd-journald.service.in
@@ -16,6 +16,7 @@ After=systemd-journald.socket systemd-journald-dev-log.socket systemd-journald-a
Before=sysinit.target
[Service]
+OOMScoreAdjust=-250
CapabilityBoundingSet=CAP_SYS_ADMIN CAP_DAC_OVERRIDE CAP_SYS_PTRACE CAP_SYSLOG CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_CHOWN CAP_DAC_READ_SEARCH CAP_FOWNER CAP_SETUID CAP_SETGID CAP_MAC_OVERRIDE
DeviceAllow=char-* rw
ExecStart=@rootlibexecdir@/systemd-journald
diff --git a/units/systemd-udevd.service.in b/units/systemd-udevd.service.in
index e8a76cc018..dbb678ae69 100644
--- a/units/systemd-udevd.service.in
+++ b/units/systemd-udevd.service.in
@@ -17,6 +17,7 @@ ConditionPathIsReadWrite=/sys
[Service]
Type=notify
+# Note that udev also adjusts the OOM score internally and will reset the value internally for its workers
OOMScoreAdjust=-1000
Sockets=systemd-udevd-control.socket systemd-udevd-kernel.socket
Restart=always