Polyakov's OOM Killer Tamer
Evgeniy Polyakov has released a patch to the kernel's out-of-memory (OOM) killer function, which was designed to prevent a system freeze in an OOM condition by sacrificing one or more processes. The patch "tames" the function by defining the specific process to kill.
As the Hungarian HUP UNIX portal announces, kernel contributor Polyakov distributed a mail message with the subject "Linux killed Kenny", which has raised some eyebrows. His patch is in response to the kernel's OOM killer function, a remedy familiar to some seasoned Linux users who have had to resort to "Ctrl+Alt+SysRq,R,E,I,S,U,B" to restart their system after experiencing a freeze due to an OOM error.
Since version 2.6, the kernel has used a "badness" scoring algorithm to find the best candidate process or processes to sacrifice in case of an OOM error. However, Polyakov claims that this OOM killer often goes "quite berserk" by nixing processes that the user didn't really want to nix, such as Firefox instead of OpenOffice or KWin instead of Java.
Polyakov thought it best to make the process to kill user-specifiable. The code has the hypothetical "Kenny" as the default "victim" process, but he changed it later in the program to an empty variable. The patch installer should substitute the actual process name by calling:
echo Java > /proc/sys/vm/oom_victim
The solution is not without its critics. Alan Cox, for example, responded in the thread that the kernel already has the /proc/self/oom_adj interface that "does the job far better." The complete thread starts here.