From: Matthew Wilcox <willy@infradead.org>
To: Zi Yan <ziy@nvidia.com>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 4/4] mm/mempolicy: Use vma_alloc_folio() in new_page()
Date: Thu, 7 Apr 2022 14:11:27 +0100 [thread overview]
Message-ID: <Yk7i/43W5brLZRAF@casper.infradead.org> (raw)
In-Reply-To: <C02AAB5E-306A-4D1F-9F82-A707DF3AD9B5@nvidia.com>
On Mon, Apr 04, 2022 at 03:51:30PM -0400, Zi Yan wrote:
> On 4 Apr 2022, at 15:30, Matthew Wilcox (Oracle) wrote:
> >
> > - if (PageHuge(page)) {
> > - return alloc_huge_page_vma(page_hstate(compound_head(page)),
> > + if (folio_test_hugetlb(src)) {
> > + return alloc_huge_page_vma(page_hstate(&src->page),
> > vma, address);
> > - } else if (PageTransHuge(page)) {
> > - struct page *thp;
> > -
> > - thp = alloc_hugepage_vma(GFP_TRANSHUGE, vma, address,
> > - HPAGE_PMD_ORDER);
> > - if (!thp)
> > - return NULL;
> > - prep_transhuge_page(thp);
> > - return thp;
> > + } else if (folio_test_large(src)) {
> > + gfp = GFP_TRANSHUGE;
> > }
>
> Nit. The two bracket pairs from the two ifs can be removed.
Even better, the first is a return, so it can simply be:
if (folio_test_hugetlb(src))
return alloc_huge_page_vma(page_hstate(&src->page),
vma, address);
if (folio_test_large(src))
gfp = GFP_TRANSHUGE;
dst = vma_alloc_folio(gfp, folio_order(src), vma, address,
folio_test_large(src));
next prev parent reply other threads:[~2022-04-07 13:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-04 19:30 [PATCH 0/4] Alternative fixes for migration Matthew Wilcox (Oracle)
2022-04-04 19:30 ` [PATCH 1/4] mm/migrate: Use a folio in alloc_migration_target() Matthew Wilcox (Oracle)
2022-04-04 19:30 ` [PATCH 2/4] mm/migrate: Use a folio in migrate_misplaced_transhuge_page() Matthew Wilcox (Oracle)
2022-04-04 19:30 ` [PATCH 3/4] mm: Add vma_alloc_folio() Matthew Wilcox (Oracle)
2022-04-04 19:30 ` [PATCH 4/4] mm/mempolicy: Use vma_alloc_folio() in new_page() Matthew Wilcox (Oracle)
2022-04-04 19:51 ` Zi Yan
2022-04-07 13:11 ` Matthew Wilcox [this message]
2022-04-04 19:53 ` [PATCH 0/4] Alternative fixes for migration Zi Yan
2022-04-07 6:14 ` William Kucharski
2022-04-07 6:16 ` William Kucharski
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=Yk7i/43W5brLZRAF@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=ziy@nvidia.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).