linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: mhocko@suse.com
Cc: hannes@cmpxchg.org, akpm@linux-foundation.org,
	linux-mm@kvack.org, aarcange@redhat.com, rientjes@google.com,
	mjaggi@caviumnetworks.com, oleg@redhat.com,
	vdavydov.dev@gmail.com
Subject: Re: [PATCH] mm,oom: use ALLOC_OOM for OOM victim's last second allocation
Date: Tue, 12 Dec 2017 17:09:36 +0900	[thread overview]
Message-ID: <201712121709.CCD95874.OHLOFQFFMVJOtS@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <20171211114229.GA4779@dhcp22.suse.cz>

Michal Hocko wrote:
> That being said, I will keep refusing other such tweaks unless you have
> a sound usecase behind. If you really _want_ to help out here then you
> can focus on the reaping of the mlock memory.

Not the reaping of the mlock'ed memory. Although Manish's report was mlock'ed
case, there are other cases (e.g. MAP_SHARED, mmu_notifier, mmap_sem held for
write) which can lead to this race condition. If we think about artificial case,
it would be possible to run 1024 threads not sharing signal_struct but consume
almost 0KB memory (i.e. written without using C library) and many of them are
running between __gfp_pfmemalloc_flags() and mutex_trylock() waiting for
ALLOC_OOM.

What the Manish's report revealed is the fact that we accidentally broke the

	/*
	 * Kill all user processes sharing victim->mm in other thread groups, if
	 * any.  They don't get access to memory reserves, though, to avoid
	 * depletion of all memory.  This prevents mm->mmap_sem livelock when an
	 * oom killed thread cannot exit because it requires the semaphore and
	 * its contended by another thread trying to allocate memory itself.
	 * That thread will now get access to memory reserves since it has a
	 * pending fatal signal.
	 */

assumption via 696453e66630ad45 ("mm, oom: task_will_free_mem should skip
oom_reaped tasks"), and we already wasted for 16 months. There is no need to
wait for fixing mlock'ed, MAP_SHARED, mmu_notifier and mmap_sem cases because
"OOM victims consuming almost 0KB memory" case cannot be solved.

The mlock'ed, MAP_SHARED, mmu_notifier and mmap_sem cases are a sort of alias
of "OOM victims consuming almost 0KB memory" case.

Anyway, since you introduced MMF_OOM_VICTIM flag, I will try a patch which
checks MMF_OOM_VICTIM instead of oom_reserves_allowed().

--
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:[~2017-12-12  9:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 11:42 Tetsuo Handa
2017-12-07 11:51 ` Michal Hocko
2017-12-07 11:59   ` Tetsuo Handa
2017-12-07 12:22     ` Michal Hocko
2017-12-08 10:58       ` Tetsuo Handa
2017-12-11 11:15         ` [PATCH] mm, oom: task_will_free_mem() should ignore MMF_OOM_SKIP unless __GFP_NOFAIL Tetsuo Handa
2017-12-11 11:44           ` Michal Hocko
2017-12-11 11:42         ` [PATCH] mm,oom: use ALLOC_OOM for OOM victim's last second allocation Michal Hocko
2017-12-12  8:09           ` Tetsuo Handa [this message]
2017-12-12 10:07             ` Michal Hocko
2017-12-11 11:57 ` Michal Hocko
2017-12-13 11:06   ` Tetsuo Handa
2017-12-19 14:36     ` Tetsuo Handa
2017-12-19 14:55       ` Michal Hocko
2017-12-21 15:34         ` Tetsuo Handa
2017-12-21 16:42           ` Michal Hocko
2017-12-23 14:41             ` 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=201712121709.CCD95874.OHLOFQFFMVJOtS@I-love.SAKURA.ne.jp \
    --to=penguin-kernel@i-love.sakura.ne.jp \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mjaggi@caviumnetworks.com \
    --cc=oleg@redhat.com \
    --cc=rientjes@google.com \
    --cc=vdavydov.dev@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