From: David Hildenbrand <david@redhat.com>
To: Matthew Wilcox <willy@infradead.org>, Fan Ni <nifan.cxl@gmail.com>
Cc: muchun.song@linux.dev, mcgrof@kernel.org,
a.manzanares@samsung.com, dave@stgolabs.net,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/hugetlb: Convert &folio->page to folio_page(folio, 0)
Date: Wed, 23 Apr 2025 21:16:47 +0200 [thread overview]
Message-ID: <c203836f-5a3c-4143-a898-1fb2bbbfda2c@redhat.com> (raw)
In-Reply-To: <aAk2dCTru-C595oY@casper.infradead.org>
On 23.04.25 20:50, Matthew Wilcox wrote:
> On Fri, Apr 18, 2025 at 03:42:45PM -0700, Fan Ni wrote:
>>>> result = install_pmd
>>>> - ? set_huge_pmd(vma, haddr, pmd, &folio->page)
>>>> + ? set_huge_pmd(vma, haddr, pmd, folio_page(folio, 0))
>>>> : SCAN_SUCCEED;
>>>
>>> I feel that set_huge_pmd() should take a folio.
>> There is a patch on the mailing list for it,
>> https://lore.kernel.org/linux-mm/20240817095122.2460977-5-wangkefeng.wang@huawei.com/
>>
>> If the above patch is needed, do_set_pmd() should be converted to use folio.
>
> Maybe? I think we'll eventually want to support folios larger than PMD
> size. So I don't want to pass in a folio here unless we can calculate the
> precise PMD-size chunk we want to map from this folio given the
> information available in vmf. I know that today the implementation
> does this:
>
> if (folio_order(folio) != HPAGE_PMD_ORDER)
> return ret;
> page = &folio->page;
>
> but eventually we should do better than that. And I don't want to
> lose the information about which page in the folio we really want
> to map. So have a think about what the right interface should be
> (passing in a page? folio + offset-in-number-of-pages? Something
> involving the PFN?)
>
> The obvious hurdle is folio_add_file_rmap_pmd() which today takes both a
> folio and a page.
The interface is prepared for that use case: I decided to pass in folio
+ page to allow for folios that span multiple PMDs. (obviously, the
internal implementation does not allow for that)
We could later change it to folio + offset, but should do so for all
rmap functions consistently.
--
Cheers,
David / dhildenb
prev parent reply other threads:[~2025-04-23 19:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-09 0:49 nifan.cxl
2025-04-09 3:15 ` Matthew Wilcox
2025-04-09 9:03 ` David Hildenbrand
2025-04-09 17:27 ` Zi Yan
2025-04-09 22:07 ` Fan Ni
2025-04-10 3:48 ` Matthew Wilcox
2025-04-18 22:42 ` Fan Ni
2025-04-23 18:50 ` Matthew Wilcox
2025-04-23 19:16 ` David Hildenbrand [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=c203836f-5a3c-4143-a898-1fb2bbbfda2c@redhat.com \
--to=david@redhat.com \
--cc=a.manzanares@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=dave@stgolabs.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mcgrof@kernel.org \
--cc=muchun.song@linux.dev \
--cc=nifan.cxl@gmail.com \
--cc=willy@infradead.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