From: David Rientjes <rientjes@google.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
netdev@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] fdtable: Avoid triggering OOMs from alloc_fdmem
Date: Tue, 4 Feb 2014 13:27:32 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.2.02.1402041312410.26019@chino.kir.corp.google.com> (raw)
In-Reply-To: <871tzirdwf.fsf@xmission.com>
On Tue, 4 Feb 2014, Eric W. Biederman wrote:
> My gut feel says if there is a code path that has __GFP_NOWARN and
> because of PAGE_ALLOC_COSTLY_ORDER we loop forever then there is
> something fishy going on.
>
The __GFP_NOWARN without __GFP_NORETRY in alloc_fdmem() is pointless
because we already know that the allocation is PAGE_ALLOC_COSTLY_ORDER or
smaller. That function encodes specific knowledge of the page allocator's
implementation so it leads me to believe that __GFP_NOWARN was intended to
be __GFP_NORETRY from the start. Otherwise, it's just set pointlessly and
specifically allows for the oom killing that you're now reporting. Since
it can fallback to vmalloc() after exhausting all of the page allocator's
capabilities, the __GFP_NOWARN|__GFP_NORETRY seems entirely appropriate.
The vmalloc() has never been called in this function because of the
infinite loop in kmalloc() because of its allocation context, but it
definitely seems better than oom killing something.
Acked-by: David Rientjes <rientjes@google.com>
> I would love to hear some people who are more current on the mm
> subsystem than I am chime in. It might be that the darn fix is going to
> be to teach __alloc_pages_slowpath to not loop forever, unless order == 0.
It doesn't loop forever, it will either return NULL because of its
allocation context or the oom killer will kill something, even for order-3
allocations. In the case that you've modified, you have sane fallback
behavior that can be utilized rather than the oom killer and __GFP_NORETRY
was reasonable from the start.
The question is simple enough: do we want to change
PAGE_ALLOC_COSTLY_ORDER to be smaller so that order-3 does return NULL
without oom killing? Perhaps there's an argument to be made that does
exactly that, but by not setting __GFP_NORETRY you are really demanding
order-3 memory at the time you allocate it and are willing to accept the
consequences to free that memory. Should we make everything except for
order-0 inherently __GFP_NORETRY and introduce a replacement __GFP_RETRY?
That's doable as well, but it would be a massive effort.
--
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>
next prev parent reply other threads:[~2014-02-04 21:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 5:26 Eric W. Biederman
2014-02-04 16:18 ` Eric Dumazet
2014-02-04 17:22 ` Eric W. Biederman
2014-02-04 18:44 ` Eric Dumazet
2014-02-04 18:57 ` Eric W. Biederman
2014-02-04 22:48 ` Eric Dumazet
2014-02-04 21:27 ` David Rientjes [this message]
2014-02-04 18:25 ` Cong Wang
2014-02-04 18:53 ` Eric W. Biederman
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.02.1402041312410.26019@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=eric.dumazet@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
/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