From: "Christian A. Ehrhardt" <lk@c--e.de>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib: kunit_iov_iter: repeatedly call alloc_pages_bulk()
Date: Mon, 25 May 2026 17:58:22 +0200 [thread overview]
Message-ID: <ahRxnpYdzPh0MTJI@cae.in-ulm.de> (raw)
In-Reply-To: <20260524-kunit_iov_iter-alloc_bulk-v1-1-4ad7cbacb19c@weissschuh.net>
Hi Thomas,
On Sun, May 24, 2026 at 03:02:45PM +0200, Thomas Weißschuh wrote:
> alloc_pages_bulk() is not guaranteed to return all requested pages
> in a single call.
>
> Call it repeatedly until all pages have been allocated or no more
> progress is being made.
>
> Fixes: 0913b7554726 ("lib: kunit_iov_iter: add tests for extract_iter_to_sg")
Diff LGTM but the "Fixes:" tag should probably point to this commit instead:
2d71340ff1d4 iov_iter: Kunit tests for copying to/from an iterator
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> lib/tests/kunit_iov_iter.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/lib/tests/kunit_iov_iter.c b/lib/tests/kunit_iov_iter.c
> index f02f7b7aa796..1e6fce9cb255 100644
> --- a/lib/tests/kunit_iov_iter.c
> +++ b/lib/tests/kunit_iov_iter.c
> @@ -53,7 +53,7 @@ static void *__init iov_kunit_create_buffer(struct kunit *test,
> size_t npages)
> {
> struct page **pages;
> - unsigned long got;
> + unsigned long got, last;
> void *buffer;
> unsigned int i;
>
> @@ -61,7 +61,15 @@ static void *__init iov_kunit_create_buffer(struct kunit *test,
> KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pages);
> *ppages = pages;
>
> - got = alloc_pages_bulk(GFP_KERNEL, npages, pages);
> + got = 0;
> + while (true) {
> + last = got;
> + got = alloc_pages_bulk(GFP_KERNEL, npages, pages);
> +
> + if (last == got || got == npages)
> + break;
> + }
> +
> if (got != npages) {
> release_pages(pages, got);
> kvfree(pages);
>
Best regards,
Christian
prev parent reply other threads:[~2026-05-25 16:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-24 13:02 Thomas Weißschuh
2026-05-25 15:58 ` Christian A. Ehrhardt [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=ahRxnpYdzPh0MTJI@cae.in-ulm.de \
--to=lk@c--e.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
/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®