Re: oom_killer crash linux system

David Rientjes
2010-10-19T18:44:09Z

On Tue, 19 Oct 2010, Figo.zhang wrote:

> > very lots of change ;)
> > can you please send us your crash log?
>
> i add some prink in select_bad_process() and oom_badness() to see
> pid/totalpages/points/memoryuseage/and finally process to selet to kill.
>

It shouldn't need any printk's to be added, the new heuristic is rather
predictable given the memory usage of the application. You could find
what the badness score is by checking /proc/pid/oom_score.

> i found it the oom-killer select: syslog-ng,mysqld,nautilus,VirtualBox
> to kill, so my question is:
>
> 1. the syslog-ng,mysqld,nautilus is the system foundamental process, so
> if oom-killer kill those process, the system will be damaged, such as
> lose some important data.
>

The oom killer always attempts to kill the most memory-hogging task that
is eligible given the context in which the system is out of memory. That
allows the kernel to free a large amount of memory so the oom killer will
not (hopefully) have to be recalled again in the near future. Otherwise,
we end up killing everything else other than the memory-hogger, and it
that may turn out to be a memory leaker that we don't care about :)

> 2. the new oom-killer just use percentage of used memory as score to
> select the candidate to kill, but how to know this process to very
> important for system?
>

The user has to tell it by using /proc/pid/oom_score_adj, see
Documentation/filesystems/proc.txt if you'd like to adjust how the oom
killer ranks tasks that you deem to be important and vital to your system.