[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 1/2] tools/xenstore: set oom score for xenstore daemon on Linux

Xenstored is absolutely mandatory for a Xen host and it can't be
restarted, so being killed by OOM-killer in case of memory shortage is
to be avoided.

Set /proc/$pid/oom_score_adj (if available) to -500 in order to allow
xenstored to use large amounts of memory without being killed.

Make sure the pid file isn't a left-over from a previous run delete it
before starting xenstored.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
- set oom score from launch script (Julien Grall)
- split off open file descriptor limit setting (Julien Grall)
 tools/hotplug/Linux/launch-xenstore.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/hotplug/Linux/launch-xenstore.in 
index 019f9d6f4d..3ad71e3d08 100644
--- a/tools/hotplug/Linux/launch-xenstore.in
+++ b/tools/hotplug/Linux/launch-xenstore.in
@@ -59,11 +59,14 @@ test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . 
                echo "No xenstored found"
                exit 1
+       rm -f @XEN_RUN_DIR@/xenstored.pid
        echo -n Starting $XENSTORED...
        $XENSTORED --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS
        systemd-notify --booted 2>/dev/null || timeout_xenstore $XENSTORED || 
exit 1
+       XS_PID=`cat @XEN_RUN_DIR@/xenstored.pid`
+       echo -500 >/proc/$XS_PID/oom_score_adj
        exit 0



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.