From: Michal Hocko <mhocko@kernel.org>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Vlastimil Babka <vbabka@suse.cz>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch] mm, thp: do not cause memcg oom for thp
Date: Thu, 22 Mar 2018 09:11:50 +0100 [thread overview]
Message-ID: <20180322081150.GX23100@dhcp22.suse.cz> (raw)
In-Reply-To: <alpine.DEB.2.20.1803211422510.107059@chino.kir.corp.google.com>
On Wed 21-03-18 14:27:10, David Rientjes wrote:
> On Wed, 21 Mar 2018, Michal Hocko wrote:
>
> > > That doesn't make sense, the allocation path needs to allocate contiguous
> > > memory for the high order, the charging path just needs to charge a number
> > > of pages. Why would the allocation and charging path be compatible when
> > > one needs to reclaim contiguous memory or compact memory and the the other
> > > just needs to reclaim any memory?
> >
> > Because you do not want to see surprises. E.g. seeing unexpected OOMs
> > for large allocatations. Just think about it. Do you really want to have
> > a different reclaim policy for the allocation and charging for all
> > allocating paths?
>
> It depends on the use of __GFP_NORETRY. If the high-order charge is
> __GFP_NORETRY, it does not oom kill. It is left to the caller.
How does the caller say it when the charge path is hidden inside the
allocator - e.g. inside kmalloc?
> Just
> because thp allocations have been special cased in the page allocator to
> be able to remove __GFP_NORETRY without fixing the memcg charge path does
> not mean memcg needs a special heuristic for high-order memory when it
> does not require contiguous memory. You say you don't want any surprises,
> but now you are changing behavior needlessly for all charges with
> order > PAGE_ALLOC_COSTLY_ORDER that do not use __GFP_NORETRY.
Not really. Only the #PF path is allowed to trigger the oom killer now
so high order allocations (mostly coming from kmalloc) do not trigger
OOM killer anyway. But this is the thing that might change in future and
therefore I think it is essential to have a different oom behavior than
the allocator.
> > You are right that the allocation path involves compaction and that is
> > different from the charging path. But that is an implementation detail
> > of the current implementation.
> >
>
> Lol, the fact that the page allocator requires contiguous memory is not an
> implementation detail of the current implementation.
The underlying mechanism might be different in future. So your lol is
not really appropriate.
> > Your patch only fixes up the current situation. Anytime a new THP
> > allocation emerges that code path has to be careful to add
> > __GFP_NORETRY to not regress again. That is just too error prone.
> >
>
> We could certainly handle it by adding helpers similar to
> alloc_hugepage_direct_gfpmask() and alloc_hugepage_khugepaged_gfpmask()
> which are employed for the same purpose for the page allocator gfp mask.
This doesn't solve the problem in general (e.g. kmalloc).
--
Michal Hocko
SUSE Labs
prev parent reply other threads:[~2018-03-22 8:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-19 21:10 David Rientjes
2018-03-20 7:16 ` Michal Hocko
2018-03-20 20:25 ` David Rientjes
2018-03-21 8:22 ` Michal Hocko
2018-03-21 19:37 ` David Rientjes
2018-03-21 20:53 ` Michal Hocko
2018-03-21 21:27 ` David Rientjes
2018-03-22 8:11 ` 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=20180322081150.GX23100@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=vbabka@suse.cz \
/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