linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: rientjes@google.com, hannes@cmpxchg.org, vdavydov@virtuozzo.com,
	linux-mm@kvack.org
Subject: Re: [PATCH] mm,oom: kill duplicated oom_unkillable_task() checks.
Date: Fri, 19 Feb 2016 18:15:33 +0100	[thread overview]
Message-ID: <20160219171533.GA23376@dhcp22.suse.cz> (raw)
In-Reply-To: <201602200101.IBE90199.OSOFMFOLVtJQHF@I-love.SAKURA.ne.jp>

On Sat 20-02-16 01:01:36, Tetsuo Handa wrote:
> Michal Hocko wrote:
> > On Fri 19-02-16 23:33:31, Tetsuo Handa wrote:
> > > Currently, oom_unkillable_task() is called for twice for each thread,
> > > once at oom_scan_process_thread() and again at oom_badness().
> > > 
> > > The reason oom_scan_process_thread() needs to call oom_unkillable_task()
> > > is to skip TIF_MEMDIE test and oom_task_origin() test if that thread is
> > > not OOM-killable.
> > > 
> > > But there is a problem with this ordering, for oom_task_origin() == true
> > > will unconditionally select that thread regardless of oom_score_adj.
> > > When we merge the OOM reaper, the OOM reaper will mark already reaped
> > > process as OOM-unkillable by updating oom_score_adj. In order to avoid
> > > falling into infinite loop, oom_score_adj needs to be checked before
> > > doing oom_task_origin() test.
> > 
> > What would be the infinite loop?
> 
> Sequence until we merge the OOM reaper:
> 
>  (1) select_bad_process() returns p due to oom_task_origin(p) == true.
>  (2) oom_kill_process() sends SIGKILL to p and sets TIF_MEMDIE on p.
>  (3) p gets stuck at down_read(&mm->mmap_sem) in exit_mm().
>  (4) The OOM killer will ignore TIF_MEMDIE on p after some timeout expires.
>  (5) select_bad_process() returns p again due to oom_task_origin(p) == true &&
>      p->mm != NULL.

And one more thing. The task will stop being oom_task_origin right
after it detects signal pending and retuns from try_to_unuse resp.
unmerge_and_remove_all_rmap_items.
-- 
Michal Hocko
SUSE Labs

--
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>

  parent reply	other threads:[~2016-02-19 17:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-19 14:33 [PATCH] mm,oom: kill duplicated oom_unkillable_task() checks Tetsuo Handa
2016-02-19 15:10 ` Michal Hocko
2016-02-19 16:01   ` Tetsuo Handa
2016-02-19 16:17     ` Michal Hocko
2016-02-19 17:15     ` Michal Hocko [this message]
2016-02-19 17:34       ` Tetsuo Handa
2016-02-19 18:40         ` Michal Hocko
2016-02-20  7:14           ` Tetsuo Handa

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=20160219171533.GA23376@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=rientjes@google.com \
    --cc=vdavydov@virtuozzo.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;
as well as URLs for NNTP newsgroup(s).