linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lstoakes@gmail.com>
To: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] mm/gup_test.c: Convert verify_dma_pinned() to us folios
Date: Sat, 17 Jun 2023 20:29:26 +0100	[thread overview]
Message-ID: <CAA5enKaOdYnX-J_ABwqxZO54+e3D-bP16hPFyjcRXDYq90LcoQ@mail.gmail.com> (raw)
In-Reply-To: <20230613201827.9441-4-vishal.moola@gmail.com>

On Tue, 13 Jun 2023 at 21:18, Vishal Moola (Oracle)
<vishal.moola@gmail.com> wrote:
>
> verify_dma_pinned() checks that pages are dma-pinned. We can convert
> this to use folios.
>
> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
> ---
>  mm/gup_test.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/mm/gup_test.c b/mm/gup_test.c
> index 8ae7307a1bb6..860b093b4b3e 100644
> --- a/mm/gup_test.c
> +++ b/mm/gup_test.c
> @@ -40,24 +40,25 @@ static void verify_dma_pinned(unsigned int cmd, struct page **pages,
>                               unsigned long nr_pages)
>  {
>         unsigned long i;
> -       struct page *page;
> +       struct folio *folio;
>
>         switch (cmd) {
>         case PIN_FAST_BENCHMARK:
>         case PIN_BASIC_TEST:
>         case PIN_LONGTERM_BENCHMARK:
>                 for (i = 0; i < nr_pages; i++) {
> -                       page = pages[i];
> -                       if (WARN(!page_maybe_dma_pinned(page),
> +                       folio = page_folio(pages[i]);
> +
> +                       if (WARN(!folio_maybe_dma_pinned(folio),
>                                  "pages[%lu] is NOT dma-pinned\n", i)) {
>
> -                               dump_page(page, "gup_test failure");
> +                               dump_page(&folio->page, "gup_test failure");
>                                 break;
>                         } else if (cmd == PIN_LONGTERM_BENCHMARK &&
> -                               WARN(!is_longterm_pinnable_page(page),
> +                               WARN(!folio_is_longterm_pinnable(folio),
>                                      "pages[%lu] is NOT pinnable but pinned\n",
>                                      i)) {
> -                               dump_page(page, "gup_test failure");
> +                               dump_page(&folio->page, "gup_test failure");
>                                 break;
>                         }
>                 }
> --
> 2.40.1
>
>

(Hope you don't mind me taking a look, GUP is of interest to me :)

Reviewed-by: Lorenzo Stoakes <lstoakes@gmail.com>


  parent reply	other threads:[~2023-06-17 19:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13 20:18 [PATCH 0/5] Replace is_longterm_pinnable_page() Vishal Moola (Oracle)
2023-06-13 20:18 ` [PATCH 1/5] mmzone: Introduce folio_is_zone_movable() Vishal Moola (Oracle)
2023-06-13 20:53   ` Matthew Wilcox
2023-06-13 20:18 ` [PATCH 2/5] mmzone: Introduce folio_migratetype() Vishal Moola (Oracle)
2023-06-13 20:53   ` Matthew Wilcox
2023-06-13 20:18 ` [PATCH 3/5] mm/gup_test.c: Convert verify_dma_pinned() to us folios Vishal Moola (Oracle)
2023-06-13 20:54   ` Matthew Wilcox
2023-06-17 19:29   ` Lorenzo Stoakes [this message]
2023-06-13 20:18 ` [PATCH 4/5] mm/gup.c: Reorganize try_get_folio() Vishal Moola (Oracle)
2023-06-13 20:29   ` Matthew Wilcox
2023-06-13 20:18 ` [PATCH 5/5] mm: Remove is_longterm_pinnable_page() and Reimplement folio_is_longterm_pinnable() Vishal Moola (Oracle)
2023-06-13 20:52   ` Matthew Wilcox

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=CAA5enKaOdYnX-J_ABwqxZO54+e3D-bP16hPFyjcRXDYq90LcoQ@mail.gmail.com \
    --to=lstoakes@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=vishal.moola@gmail.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