Polyakov's OOM Killer Tamer

Jan 19, 2009

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.

Related content

  • OOM Killer

    When a Linux system runs out of memory, a special agent, the out-of-memory killer, rushes to its aid. Facebook has now introduced its own OOM killer. What makes it different from its kernel-based counterpart? And what is an OOM killer really?

  • Kernel News

    Zack Brown reports on container-aware cgroups, a different type of RAM chip on a single system, new SARA security framework, and improving GPIO interrupt handling.

  • Kernel News

    Improving the Android low memory killer; randomizing the Kernel stack; and best practices.

  • ZACK'S KERNEL NEWS
  • Security Lessons

    When a test kernel starts wrecking network cards, the community gets busy.

comments powered by Disqus

Issue 36: Getting Started with Linux – /Special Editions

Buy this issue as a PDF

Digital Issue: Price $15.99
(incl. VAT)

News