Subject: Re: [vserver] oom-killer killapps on hosts not not guest
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Wed, 19 Aug 2009 15:23:33 +0200

On Wed, Aug 19, 2009 at 11:51:46AM +1200, Michael wrote:
> Hi,

> I've got a test server with 8Gb RAM
> setup guest with rss.hard=90000  rss.soft=40000

> now run
> stress --cpu 4 --vm 8 --vm-bytes 50M

> Got oom-killer on host killing applicatioin on not guest but on host.
> How to avoid this?

you can avoid that by making host processes immune
to the OOM killer, or by raising the badness_bias of
the guests above any host vm usage, or disable
overcommit completely

> I've tring to setup vm.overcommit_memory=2  which doesen't help

probably because you left the overcommit_ratio untouched,
but you want to set this to 0 too

> The only option seems to be
> vm.oom_kill_allocating_task = 1

this is another way to address this specific case, but
it might not be the best for the entire system

> Is it a right way to do it?

the OOM 'badness' which is the criterion used to choose
the 'victim' is calculated like this:

 1) total_vm of a process (system wide) plus
 2) the badness_bias (if in a guest, default is 0) plus
 3) the difference between rss_curr and rss_soft

this is how it is calculated right now, with one exception,
if there is a swapoff process running, it gets full score :)

we might add another 'difference' based on the vm
settings or some kind of multiplicative factor to that
(if you like to test it, let me know)

HTH,
Herbert

> -- 
> --
> Michael