From: Andrew Vagin <avagin@gmail.com>
To: David Rientjes <rientjes@google.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Andrey Vagin <avagin@openvz.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: skip zombie in OOM-killer
Date: Mon, 7 Mar 2011 14:55:37 +0300 [thread overview]
Message-ID: <AANLkTi=d+eZxg_NgNWa7roo=1YQS06=EaWJzjseL_Hhs@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1103061400170.23737@chino.kir.corp.google.com>
[-- Attachment #1: Type: text/plain, Size: 2172 bytes --]
2011/3/7 David Rientjes <rientjes@google.com>:
> On Sun, 6 Mar 2011, KOSAKI Motohiro wrote:
>
>> > When we check that task has flag TIF_MEMDIE, we forgot check that
>> > it has mm. A task may be zombie and a parent may wait a memor.
>> >
>> > v2: Check that task doesn't have mm one time and skip it immediately
>> >
>> > Signed-off-by: Andrey Vagin <avagin@openvz.org>
>>
>> This seems incorrect. Do you have a reprodusable testcasae?
>> Your patch only care thread group leader state, but current code
>> care all thread in the process. Please look at oom_badness() and
>> find_lock_task_mm().
>>
>
> That's all irrelevant, the test for TIF_MEMDIE specifically makes the oom
> killer a complete no-op when an eligible task is found to have been oom
> killed to prevent needlessly killing additional tasks. oom_badness() and
> find_lock_task_mm() have nothing to do with that check to return
> ERR_PTR(-1UL) from select_bad_process().
>
> Andrey is patching the case where an eligible TIF_MEMDIE process is found
> but it has already detached its ->mm. In combination with the patch
> posted to linux-mm, oom: prevent unnecessary oom kills or kernel panics,
> which makes select_bad_process() iterate over all threads, it is an
> effective solution.
Probably you said about the first version of my patch.
This version is incorrect because of
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dd8e8f405ca386c7ce7cbb996ccd985d283b0e03
but my first patch is correct and it has a simple reproducer(I
attached it). You can execute it and your kernel hangs up, because the
parent doesn't wait children, but the one child (zombie) will have
flag TIF_MEMDIE, oom_killer will kill nobody
The link on the first patch:
http://groups.google.com/group/linux.kernel/browse_thread/thread/b9c6ddf34d1671ab/2941e1877ca4f626?lnk=raot&pli=1
>
> Thanks.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
[-- Attachment #2: memeater_killer.py --]
[-- Type: application/octet-stream, Size: 780 bytes --]
import sys, time, mmap, os
from subprocess import Popen, PIPE
import random
global mem_size
def info(msg):
pid = os.getpid()
print >> sys.stderr, "%s: %s" % (pid, msg)
sys.stderr.flush()
def memory_loop(cmd = "a"):
"""
cmd may be:
c: check memory
else: touch memory
"""
c = 0
for j in xrange(0, mem_size):
if cmd == "c":
if f[j<<12] != chr(j % 255):
info("Data corruption")
sys.exit(1)
else:
f[j<<12] = chr(j % 255)
for i in xrange(20):
pid = os.fork()
time.sleep(1)
if (pid == 0):
sys.stdout.write("mmap\n")
sys.stdout.flush()
mem_size = 400 * 1024
f = mmap.mmap(-1, mem_size << 12, mmap.MAP_ANONYMOUS|mmap.MAP_PRIVATE)
memory_loop()
time.sleep(100)
f.close()
sys.stdout.write("ummap\n")
sys.stdout.flush()
time.sleep(100)
next prev parent reply other threads:[~2011-03-07 11:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-05 0:51 Andrey Vagin
2011-03-06 2:44 ` David Rientjes
2011-03-06 10:37 ` KOSAKI Motohiro
2011-03-06 22:03 ` David Rientjes
2011-03-07 11:55 ` Andrew Vagin [this message]
2011-03-07 20:36 ` David Rientjes
2011-03-07 21:52 ` Andrew Morton
2011-03-07 23:43 ` David Rientjes
2011-03-08 1:24 ` KOSAKI Motohiro
2011-03-08 2:07 ` KOSAKI Motohiro
2011-03-08 2:10 ` KOSAKI Motohiro
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='AANLkTi=d+eZxg_NgNWa7roo=1YQS06=EaWJzjseL_Hhs@mail.gmail.com' \
--to=avagin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=avagin@openvz.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.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