]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journald: slightly bump OOM adjust for journald (#13366)
authorLennart Poettering <lennart@poettering.net>
Thu, 22 Aug 2019 08:02:28 +0000 (10:02 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 22 Aug 2019 08:02:28 +0000 (10:02 +0200)
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)

TODO
src/shutdown/shutdown.c
units/systemd-journald.service.in
units/systemd-udevd.service.in

diff --git a/TODO b/TODO
index 78189ce5e9a078d69ce9ee2fa6d7bf7471c0671b..c5b5b86057ba3c13af7b7561b807a97ed5cb509f 100644 (file)
--- 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
 
index a574a0704190bb845836feb144695b6e1666a25f..0eb17989d0a54948eef3664bb9eb3bea9fcd24ab 100644 (file)
@@ -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)
index 323334f6a3987431d706467991fb8d5f35007edc..089bc38f5971260c3564f254a96fd3ca8007eda9 100644 (file)
@@ -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
index e8a76cc0184258a04a70a4ee30b6f4cf3a288079..dbb678ae692664b073fb0c1a4c955006b5feeda8 100644 (file)
@@ -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