Patch to increase out-of-memory score for localapps

Alkis Georgopoulos <[email protected]> Sun, 05 Sep 2010 08:21:20 +0300
Newsgroups gmane.linux.terminal-server.devel
Message-ID <1283664080.1576.8.camel@alkis>
The following should make the OOM-killer prefer to kill localapps on out
of memory conditions, instead of e.g. killing the ssh connection (which
would result in all localapps dying anyway).

I'm not using localapps so I can't test it, I was just reading the
"proc" man page and I came across it, so I thought I'd post it in case
anyone is interested in testing/committing it.

Cheers,
Alkis

$ bzr diff
=== modified file 'localapps/ltsp-localappsd'
--- localapps/ltsp-localappsd	2009-11-16 23:42:52 +0000
+++ localapps/ltsp-localappsd	2010-09-05 05:14:52 +0000
@@ -33,6 +33,11 @@
 [ -n "$LDM_PRINTER_DEFAULT" ] && export CLIENT_ENV="${CLIENT_ENV} PRINTER=${LDM_PRINTER_DEFAULT}"
 [ -n "$LDM_PRINTER_LIST" ] && export CLIENT_ENV="${CLIENT_ENV} PRINTER_LIST=${LDM_PRINTER_LIST}"
 
+# On out of memory conditions, localapps should be killed before any other process like e.g. ssh
+if [ -f /proc/$$/oom_adj ]; then
+    echo 10 > /proc/$$/oom_adj || true
+fi
+
 # Poll for LTSP_COMMAND changes and execute
 while :; do
     LTSP_COMMAND="$(xatomwait LTSP_COMMAND)"



------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_____________________________________________________________________
Ltsp-developer mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-developer
For additional LTSP help,   try #ltsp channel on irc.freenode.net