]> git.proxmox.com Git - mirror_lxcfs.git/commitdiff
set oom_score_adj of lxcfs process to -1000
authorTeng Hu <huteng.ht@bytedance.com>
Tue, 23 Aug 2022 09:31:58 +0000 (17:31 +0800)
committerTeng Hu <huteng.ht@bytedance.com>
Tue, 23 Aug 2022 13:27:36 +0000 (21:27 +0800)
Disable oom killing entirely to minimize the hassle comes from
lxcfs exiting unexpectedly, e.g. the mountpoint got lost.

Signed-off-by: Teng Hu <huteng.ht@bytedance.com>
config/init/systemd/lxcfs.service.in
config/init/sysvinit/lxcfs
config/init/upstart/lxcfs.conf

index 9da02f6ce7481bced50efcc6a075e8290a2fbf1d..8b43f5a39646db4f7f6d1a2662efe543e703087c 100644 (file)
@@ -5,6 +5,7 @@ Before=lxc.service
 Documentation=man:lxcfs(1)
 
 [Service]
+OOMScoreAdjust=-1000
 ExecStart=/usr/bin/lxcfs {{LXCFSTARGETDIR}}
 KillMode=process
 Restart=on-failure
index 4061b48cc383d88b39785e0c43badd541705ed53..05d6aefb0d11b9b30588812752c1360d6551b3ee 100755 (executable)
@@ -16,6 +16,7 @@ DAEMON=/usr/bin/lxcfs
 NAME=lxcfs
 DESC="FUSE filesystem for LXC"
 PIDFILE=/var/run/lxcfs.pid
+OOM_SCORE_ADJ="-1000"
 
 . /lib/lsb/init-functions
 
@@ -41,6 +42,7 @@ case "$1" in
         echo -n "Starting $DESC: "
         if start-stop-daemon ${START} -- /var/lib/lxcfs >/dev/null 2>&1 ; then
             echo "${NAME}."
+            echo ${OOM_SCORE_ADJ} > /proc/`cat ${PIDFILE}`/oom_score_adj
         else
             if start-stop-daemon --test ${START} >/dev/null 2>&1; then
                 echo "(failed)."
index 37aa475a6d422956c7b848ee4e6c5378107284b4..7974068f1cbada231255a03381edaf5873081310 100644 (file)
@@ -4,6 +4,7 @@ author "Stéphane Graber <stgraber@ubuntu.com>"
 start on starting lxc or starting lxd or runlevel [2345]
 stop on runlevel [06]
 
+oom score -1000
 respawn
 
 pre-start script