From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Rik van Riel <riel@surriel.com>,
Yuan-Hao Hsu <aa9736195201@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
John Hubbard <jhubbard@nvidia.com>, Peter Xu <peterx@redhat.com>,
Lorenzo Stoakes <ljs@kernel.org>,
liam@infradead.org, Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Aristeu Rozanski <aris@ruivo.org>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/gup: batch PTE-mapped large folios in gup_fast_pte_range()
Date: Wed, 7 Oct 2026 12:14:36 +0200 [thread overview]
Message-ID: <36599ffd-8f7c-43e4-8ea5-ddef02a77c08@kernel.org> (raw)
In-Reply-To: <fca681e9e9af66c8bbc43a181409ef44a24d9250.camel@surriel.com>
On 10/7/26 12:07, Rik van Riel wrote:
> On Thu, 2026-09-17 at 10:42 +0200, David Hildenbrand (Arm) wrote:
>> On 9/17/26 10:37, Yuan-Hao Hsu wrote:
>>> GUP-fast grabs a PTE-mapped large folio one page at a time. Every
>>> PTE
>>> costs a try_grab_folio_fast() (a refcount cmpxchg, plus the
>>> pincount
>>> atomic, a full barrier and a node stat update for FOLL_PIN), a
>>> gup_fast_folio_allowed() and a folio_set_referenced(), so a 64 kB
>>> mTHP
>>> pays sixteen of each and a PTE-mapped 2 MB THP pays 512. The PMD
>>> and
>>> PUD leaf paths already take the whole range with one
>>> try_grab_folio_fast() call, and the slow path is getting the same
>>> treatment for PTEs in Rik's follow_page_mask() series.
>>>
>>> IORING_REGISTER_BUFFERS of 1 GB, median of 15:
>>>
>>> 64 kB mTHP 6179/5998 us -> 1599 us
>>> 1 MB mTHP 5790/5801 us -> 893 us
>>> 4 kB pages 7173/6741 us -> 6763 us
>>>
>>
>> I think Rik was already working on this and sent some patches.
>> Anyhow, there is
>> quite some GUP review backlog I have t go through, so this will have
>> to wait.
>
> My patches are for the regular gup path, in
> follow_pages_mask()
>
> This is for the gup_fast path.
>
> Unfortunately there is some nearly duplicated
> code between them. Last I looked I did not
> find any clear ways to merge them, but I
> can take another look if you want.
We'll likely have to keep it separate.
I looked at the patch here and it needs quite some work do do it cleanly. Too
much for me to comment on this, so I'll likely end up doing it myself or
delegate it to someone internally.
--
Cheers,
David
next prev parent reply other threads:[~2026-10-07 10:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 8:37 Yuan-Hao Hsu
2026-09-17 8:42 ` David Hildenbrand (Arm)
2026-09-17 8:43 ` David Hildenbrand (Arm)
2026-09-17 9:01 ` Yuan-Hao Hsu
2026-10-07 10:07 ` Rik van Riel
2026-10-07 10:14 ` David Hildenbrand (Arm) [this message]
2026-10-07 10:47 ` Rik van Riel
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=36599ffd-8f7c-43e4-8ea5-ddef02a77c08@kernel.org \
--to=david@kernel.org \
--cc=aa9736195201@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aris@ruivo.org \
--cc=dev.jain@arm.com \
--cc=jgg@ziepe.ca \
--cc=jhubbard@nvidia.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=peterx@redhat.com \
--cc=riel@surriel.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=surenb@google.com \
--cc=vbabka@kernel.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
all inboxes | Powered by JetHome®