linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	vedran.furac@gmail.com, Andrew Morton <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	minchan.kim@gmail.com,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>
Subject: Re: [PATCH v3] oom-kill: add lowmem usage aware oom kill handling
Date: Fri, 29 Jan 2010 13:07:01 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.00.1001291258490.2938@chino.kir.corp.google.com> (raw)
In-Reply-To: <5a0e6098f900aa36993b2b7f2320f927.squirrel@webmail-b.css.fujitsu.com>

On Sat, 30 Jan 2010, KAMEZAWA Hiroyuki wrote:

> okay...I guess the cause of the problem Vedran met came from
> this calculation.
> ==
>  109         /*
>  110          * Processes which fork a lot of child processes are likely
>  111          * a good choice. We add half the vmsize of the children if they
>  112          * have an own mm. This prevents forking servers to flood the
>  113          * machine with an endless amount of children. In case a single
>  114          * child is eating the vast majority of memory, adding only half
>  115          * to the parents will make the child our kill candidate of
> choice.
>  116          */
>  117         list_for_each_entry(child, &p->children, sibling) {
>  118                 task_lock(child);
>  119                 if (child->mm != mm && child->mm)
>  120                         points += child->mm->total_vm/2 + 1;
>  121                 task_unlock(child);
>  122         }
>  123
> ==
> This makes task launcher(the fist child of some daemon.) first victim.

That "victim", p, is passed to oom_kill_process() which does this:

	/* Try to kill a child first */
	list_for_each_entry(c, &p->children, sibling) {
		if (c->mm == p->mm)
			continue;
		if (!oom_kill_task(c))
			return 0;
	}
	return oom_kill_task(p);

which prevents your example of the task launcher from getting killed 
unless it itself is using such an egregious amount of memory that its VM 
size has caused the heuristic to select the daemon in the first place.  
We only look at a single level of children, and attempt to kill one of 
those children not sharing memory with the selected task first, so your 
example is exaggerated for dramatic value.

The oom killer has been doing this for years and I haven't noticed a huge 
surge in complaints about it killing X specifically because of that code 
in oom_kill_process().

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-01-29 21:07 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-29 16:11 KAMEZAWA Hiroyuki
2010-01-29 16:21 ` Alan Cox
2010-01-29 16:25   ` KAMEZAWA Hiroyuki
2010-01-29 16:30     ` Alan Cox
2010-01-29 16:41       ` KAMEZAWA Hiroyuki
2010-01-29 21:07         ` David Rientjes [this message]
2010-01-30 12:46           ` Vedran Furač
2010-01-30 22:53             ` David Rientjes
2010-01-31 20:29               ` Vedran Furač
2010-02-01 10:33                 ` David Rientjes
2010-02-01  0:01           ` KAMEZAWA Hiroyuki
2010-02-01 10:28             ` David Rientjes
2010-01-29 21:11     ` David Rientjes
  -- strict thread matches above, loose matches on Subject: below --
2010-01-21  5:59 [PATCH] " KAMEZAWA Hiroyuki
2010-01-22  6:23 ` [PATCH v2] " KAMEZAWA Hiroyuki
2010-01-25  6:15   ` [PATCH v3] " KAMEZAWA Hiroyuki
2010-01-26 23:12     ` Andrew Morton
2010-01-26 23:53       ` KAMEZAWA Hiroyuki
2010-01-27  0:19         ` Andrew Morton
2010-01-27  0:58           ` KAMEZAWA Hiroyuki
2010-01-27 23:56             ` David Rientjes
2010-01-28  0:16             ` Alan Cox
2010-01-28  0:26               ` KAMEZAWA Hiroyuki
2010-01-28  0:59               ` David Rientjes
2010-01-29  0:25               ` Vedran Furač
2010-01-29  0:35                 ` Alan Cox
2010-01-29  0:57                   ` Vedran Furač
2010-01-29 11:03                     ` Alan Cox
2010-01-30 12:33                       ` Vedran Furač
2010-01-30 12:59                         ` Alan Cox
2010-01-30 17:30                           ` Vedran Furač
2010-01-30 17:45                             ` Alan Cox
2010-01-30 18:17                               ` Vedran Furač
2010-01-27 23:46         ` David Rientjes
2010-01-26 23:16     ` Andrew Morton
2010-01-26 23:44       ` KAMEZAWA Hiroyuki
2010-01-27 23:40     ` David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.1001291258490.2938@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan.kim@gmail.com \
    --cc=vedran.furac@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox