From: Boszormenyi Zoltan on
Hi,

one of our clients wanted the possibility to specify which processes
do they want to get killed first by the OOM-killer in case of low memory.
The agreement included posting the result upstream. The original
was implemented on 2.6.27, it was adapted to 2.6.33-rc8 as well.
Both patches are included.

There's a new /proc/sys/vm/oom_preferred_tasks file which accepts
a string. E.g.:

# echo "/usr/bin/httpd,myforkbomb,oocalc" >/proc/sys/vm/oom_preferred_tasks

The string must contain comma separated process names or executable
pathnames. Upon calling out_of_memory(), the processes are checked
against the list of names. The process name matching is performed in
this order:

1. full pathname of the executable using /proc/PID/exe link
2. executable name without full pathname
3. process name using get_task_comm()

If no such matching process is found, the usual badness check is performed.

Best regards,
Zolt�n B�sz�rm�nyi

--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zolt�n B�sz�rm�nyi
Cybertec Sch�nig & Sch�nig GmbH
http://www.postgresql.at/