From: Michal Hocko <mhocko@suse.cz>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
linux-mm@kvack.org, Mel Gorman <mgorman@suse.de>,
David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: why do we do ALLOC_WMARK_HIGH before going out_of_memory
Date: Fri, 29 Jan 2016 17:29:01 +0100 [thread overview]
Message-ID: <20160129162901.GJ32174@dhcp22.suse.cz> (raw)
In-Reply-To: <20160129161257.GI32174@dhcp22.suse.cz>
On Fri 29-01-16 17:12:57, Michal Hocko wrote:
> On Fri 29-01-16 16:56:45, Andrea Arcangeli wrote:
> > On Fri, Jan 29, 2016 at 03:38:06PM +0100, Michal Hocko wrote:
> > > That would require the oom victim to release the memory and drop
> > > TIF_MEMDIE before we go out_of_memory again. And that might happen
> > > anytime whether we are holding oom_trylock or not because it doesn't
> > > synchronize the exit path. So we are basically talking about:
> > >
> > > should_alloc_retry
> > > [1]
> > > get_page_from_freelist(ALLOC_WMARK_HIGH)
> > > [2]
> > > out_of_memory
> > >
> > > and the race window for 1 is much smaller than 2 because [2] is quite
> >
> > [1] is before should_alloc_retry is set. It covers the entire reclaim.
> >
> > > costly operation. I wonder if this last moment request ever succeeds. I
> > > have run my usual oom flood tests and it hasn't shown up a single time.
> >
> > For this check to make a difference, you need a lot of small programs
> > all hitting OOM at the same time.
>
> That is essentially my oom flood testing program doing. Spawning
> hundreds of paralell anon mem eaters.
>
> > Perhaps the trylock on the oom_lock
> > tends to hide the race like you suggested earlier but it doesn't sound
> > accurate if we proceed to oom kill without checking the high wmark at all
> > before killing another task after a random reclaim failure.
>
> The thing is that the reclaim would have to reclaim consistently after
> the rework.
Ble. It should read: would have to fail to reclaim consistently or
have only very small chance to reclaim enough to fulfill to allocation
request (even if we reclaimed all the reclaimable memory combined with
the free memory). So the chances to succeed after should_alloc_retry are
quite small. The race is there of course and something might have just
freed a bulk of memory but my primary point is that [1] is way too small
to make a difference. It would if we slept on the lock of course but
that is not happening.
Anyway I have refrained from pursuing the patch to remove this last
minute check. It is definitely not harmful.
--
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>
prev parent reply other threads:[~2016-01-29 16:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-28 16:38 why do we do ALLOC_WMARK_HIGH before going out_of_memory Michal Hocko
2016-01-28 19:02 ` Andrea Arcangeli
2016-01-28 20:11 ` Michal Hocko
2016-01-28 21:12 ` Johannes Weiner
2016-01-28 21:55 ` Michal Hocko
2016-01-28 23:40 ` Johannes Weiner
2016-01-29 14:38 ` Michal Hocko
2016-01-29 15:56 ` Andrea Arcangeli
2016-01-29 16:12 ` Michal Hocko
2016-01-29 16:29 ` Michal Hocko [this message]
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=20160129162901.GJ32174@dhcp22.suse.cz \
--to=mhocko@suse.cz \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--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;
as well as URLs for NNTP newsgroup(s).