From: Michal Hocko <mhocko@suse.com>
To: Rik van Riel <riel@surriel.com>
Cc: hughd@google.com, xuyu@linux.alibaba.com,
akpm@linux-foundation.org, mgorman@suse.de, aarcange@redhat.com,
willy@infradead.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com, linux-mm@kvack.org, vbabka@suse.cz
Subject: Re: [PATCH 2/3] mm,thp,shm: limit gfp mask to no more than specified
Date: Fri, 27 Nov 2020 08:52:14 +0100 [thread overview]
Message-ID: <20201127075214.GK31550@dhcp22.suse.cz> (raw)
In-Reply-To: <920c627330f3c7d295ab58edd1b62f28fdbd14bc.camel@surriel.com>
On Thu 26-11-20 13:04:14, Rik van Riel wrote:
> On Thu, 2020-11-26 at 14:40 +0100, Michal Hocko wrote:
> > On Tue 24-11-20 14:49:24, Rik van Riel wrote:
> > > Matthew Wilcox pointed out that the i915 driver opportunistically
> > > allocates tmpfs memory, but will happily reclaim some of its
> > > pool if no memory is available.
> > >
> > > Make sure the gfp mask used to opportunistically allocate a THP
> > > is always at least as restrictive as the original gfp mask.
> >
> > I have brought this up in the previous version review and I feel my
> > feedback hasn't been addressed. Please describe the expected behavior
> > by
> > those shmem users including GFP_KERNEL restriction which would make
> > the
> > THP flags incompatible. Is this a problem? Is there any actual
> > problem
> > if the THP uses its own set of flags?
>
> In the case of i915, the gfp flags passed in by the i915
> driver expect the VM to easily fail the allocation, in
> which case the i915 driver will reclaim some existing
> buffers and try again.
The existing code tries hard to prevent from the oom killer AFAIU.
At least that is what i915_gem_object_get_pages_gtt says. And that is
ok for order-0 (or low order) requests. But THPs are costly orders and
therefore __GFP_NORETRY has a different meaning. It still controls how
hard to try compact but this is not a OOM control. ttm_tt_swapout is
similar except it chosen to try harder for order-0 cases but still want
to prevent the oom killer.
> Trying harder than the original gfp_mask would change the OOM behavior
> of systems using the i915 driver.
>
> > I am also not happy how those two sets of flags are completely
> > detached
> > and we can only expect surprises there.
>
> I would be more than happy to implement things differently,
> but I am not sure what alternative you are suggesting.
Simply do not alter gfp flags? Or warn in some cases of a serious mismatch.
E.g. GFP_ZONEMASK mismatch because there are already GFP_KERNEL users of
shmem.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2020-11-27 7:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-24 19:49 [PATCH v6 0/3] mm,thp,shm: limit shmem THP alloc gfp_mask Rik van Riel
2020-11-24 19:49 ` [PATCH 1/3] mm,thp,shmem: " Rik van Riel
2020-11-26 16:56 ` Vlastimil Babka
2020-11-27 8:15 ` Michal Hocko
2020-11-24 19:49 ` [PATCH 2/3] mm,thp,shm: limit gfp mask to no more than specified Rik van Riel
2020-11-26 13:40 ` Michal Hocko
2020-11-26 18:04 ` Rik van Riel
2020-11-27 7:52 ` Michal Hocko [this message]
2020-11-27 19:03 ` Rik van Riel
2020-11-30 10:00 ` Michal Hocko
2020-11-30 14:40 ` Rik van Riel
2020-11-24 19:49 ` [PATCH 3/3] mm,thp,shmem: make khugepaged obey tmpfs mount flags Rik van Riel
2020-11-26 17:18 ` Vlastimil Babka
2020-11-26 18:14 ` Rik van Riel
2020-11-26 19:42 ` Vlastimil Babka
2020-11-26 20:14 ` Rik van Riel
2020-12-14 21:16 ` [PATCH v6 0/3] mm,thp,shm: limit shmem THP alloc gfp_mask Hugh Dickins
2020-12-14 22:20 ` Andrew Morton
2020-12-14 22:52 ` Vlastimil Babka
2021-02-24 8:41 ` Hugh Dickins
2021-02-24 14:46 ` Rik van Riel
2021-02-24 16:55 ` Hugh Dickins
2021-02-24 17:10 ` [PATCH 4/3] mm,shmem,thp: limit shmem THP allocations to requested zones Rik van Riel
2021-02-26 12:34 ` Vlastimil Babka
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=20201127075214.GK31550@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=riel@surriel.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
--cc=xuyu@linux.alibaba.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