From 3e7dbdcdba6431d57c24864c3fb96882a3383e52 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 15 Mar 2013 23:21:22 +0100 Subject: [PATCH] gsmd: Adjust the oom score of the monitor process Adjust the score for the monitor process. The issue is that the score is inherited by the process. Right now the score of the child is adjusted _after_ the process has been spawned. This is obviously a race condition. --- recipes-openmoko/openmoko-gsmd/files/gsmd-respawn.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes-openmoko/openmoko-gsmd/files/gsmd-respawn.sh b/recipes-openmoko/openmoko-gsmd/files/gsmd-respawn.sh index b1fe134326..99435ed966 100644 --- a/recipes-openmoko/openmoko-gsmd/files/gsmd-respawn.sh +++ b/recipes-openmoko/openmoko-gsmd/files/gsmd-respawn.sh @@ -4,13 +4,17 @@ NAME=`basename $1` PIDFILE="/var/run/$NAME.pid" PID=$$ echo "$PID" > $PIDFILE +echo "-1000" > /proc/$PID/oom_score_adj trap "{ rm -f $PIDFILE ; kill 0; }" EXIT while true; do echo "Restarting not dealing well with spaces.." - (exec $*) || true + exec $* & + LAST_PID=$! + echo "0" > /proc/$LAST_PID/oom_score_adj + wait $LAST_PID sleep 10s done