From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Aristeu Rozanski <aris@ruivo.org>, linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jason Gunthorpe <jgg@ziepe.ca>,
John Hubbard <jhubbard@nvidia.com>, Peter Xu <peterx@redhat.com>
Subject: Re: [PATCH 2/2] mm: gup: cleanup the gup_fast_*() call chain
Date: Thu, 19 Feb 2026 10:42:28 +0100 [thread overview]
Message-ID: <94f03cb9-c7eb-4a7e-8952-ec56697a2816@kernel.org> (raw)
In-Reply-To: <20260219050250.266876166@ruivo.org>
On 2/19/26 06:02, Aristeu Rozanski wrote:
> Refactor gup_fast functions so each step of the way returns the number of
> pages pinned. Because the previous step of the chain knows what the number
> it should be, less indicates an error. This way there's no need to pass *nr
> along.
>
> Suggested-by: David Hildenbrand <david@kernel.org>
> Link: https://lore.kernel.org/all/85e760cf-b994-40db-8d13-221feee55c60@redhat.com/T/#u
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: David Hildenbrand <david@kernel.org>
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: Peter Xu <peterx@redhat.com>
> Signed-off-by: Aristeu Rozanski <aris@ruivo.org>
[...]
> -static int gup_fast_pud_leaf(pud_t orig, pud_t *pudp, unsigned long addr,
> - unsigned long end, unsigned int flags, struct page **pages,
> - int *nr)
> +static unsigned long gup_fast_pud_leaf(pud_t orig, pud_t *pudp,
> + unsigned long addr, unsigned long end,
> + unsigned int flags, struct page **pages)
> {
> struct page *page;
> struct folio *folio;
> - int refs;
> + unsigned long nr_pages = 0, i;
I don't think there is a need to initialize nr_pages to 0 here.
[...]
>
> @@ -3129,8 +3139,7 @@ static bool gup_fast_permitted(unsigned
> static unsigned long gup_fast(unsigned long start, unsigned long end,
> unsigned int gup_flags, struct page **pages)
> {
> - unsigned long flags;
> - int nr_pinned = 0;
> + unsigned long flags, nr_pinned = 0;
I don't think we have to initialize nr_pinned to 0 anymore.
> unsigned seq;
>
> if (!IS_ENABLED(CONFIG_HAVE_GUP_FAST) ||
> @@ -3154,7 +3163,7 @@ static unsigned long gup_fast(unsigned l
> * that come from callers of tlb_remove_table_sync_one().
> */
> local_irq_save(flags);
> - gup_fast_pgd_range(start, end, gup_flags, pages, &nr_pinned);
> + nr_pinned = gup_fast_pgd_range(start, end, gup_flags, pages);
> local_irq_restore(flags);
>
> /*
>
In general, LGTM, and our gup tests seem to pass.
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
prev parent reply other threads:[~2026-02-19 9:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-19 5:02 [PATCH 0/2] mm: gup: cleanup gup_fast " Aristeu Rozanski
2026-02-19 5:02 ` [PATCH 1/2] mm: gup: move pmd_protnone() into gup_fast_pmd_leaf() Aristeu Rozanski
2026-02-19 9:21 ` David Hildenbrand (Arm)
2026-02-19 5:02 ` [PATCH 2/2] mm: gup: cleanup the gup_fast_*() call chain Aristeu Rozanski
2026-02-19 9:42 ` David Hildenbrand (Arm) [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=94f03cb9-c7eb-4a7e-8952-ec56697a2816@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=aris@ruivo.org \
--cc=jgg@ziepe.ca \
--cc=jhubbard@nvidia.com \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.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