From: Rik van Riel <riel@surriel.com>
To: Hugh Dickins <hughd@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
xuyu@linux.alibaba.com, mgorman@suse.de, aarcange@redhat.com,
willy@infradead.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com, linux-mm@kvack.org, mhocko@suse.com
Subject: [PATCH 4/3] mm,shmem,thp: limit shmem THP allocations to requested zones
Date: Wed, 24 Feb 2021 12:10:16 -0500 [thread overview]
Message-ID: <20210224121016.1314ed6d@imladris.surriel.com> (raw)
In-Reply-To: <alpine.LSU.2.11.2102240854140.10197@eggly.anvils>
On Wed, 24 Feb 2021 08:55:40 -0800 (PST)
Hugh Dickins <hughd@google.com> wrote:
> On Wed, 24 Feb 2021, Rik van Riel wrote:
> > On Wed, 2021-02-24 at 00:41 -0800, Hugh Dickins wrote:
> > > Oh, I'd forgotten all about that gma500 aspect:
> > > well, I can send a fixup later on.
> >
> > I already have code to fix that, which somebody earlier
> > in this discussion convinced me to throw away. Want me
> > to send it as a patch 4/3 ?
>
> If Andrew wants it all, yes, please do add that - thanks Rik.
Trivial patch to fix the gma500 thing below:
---8<---
mm,shmem,thp: limit shmem THP allocations to requested zones
Hugh pointed out that the gma500 driver uses shmem pages, but needs
to limit them to the DMA32 zone. Ensure the allocations resulting from
the gfp_mask returned by limit_gfp_mask use the zone flags that were
originally passed to shmem_getpage_gfp.
Signed-off-by: Rik van Riel <riel@surriel.com>
Suggested-by: Hugh Dickins <hughd@google.com>
---
mm/shmem.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index ee3cea10c2a4..876fec89686f 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1539,7 +1539,11 @@ static gfp_t limit_gfp_mask(gfp_t huge_gfp, gfp_t limit_gfp)
{
gfp_t allowflags = __GFP_IO | __GFP_FS | __GFP_RECLAIM;
gfp_t denyflags = __GFP_NOWARN | __GFP_NORETRY;
- gfp_t result = huge_gfp & ~allowflags;
+ gfp_t zoneflags = limit_gfp & GFP_ZONEMASK;
+ gfp_t result = huge_gfp & ~(allowflags | GFP_ZONEMASK);
+
+ /* Allow allocations only from the originally specified zones. */
+ result |= zoneflags;
/*
* Minimize the result gfp by taking the union with the deny flags,
next prev parent reply other threads:[~2021-02-24 17:10 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
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 ` Rik van Riel [this message]
2021-02-26 12:34 ` [PATCH 4/3] mm,shmem,thp: limit shmem THP allocations to requested zones 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=20210224121016.1314ed6d@imladris.surriel.com \
--to=riel@surriel.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=mhocko@suse.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