[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fe1ecb39-abbc-452c-b3a3-61d63ca32244@kernel.org>
Date: Thu, 22 Jan 2026 23:18:39 +0100
From: "David Hildenbrand (Red Hat)" <david@...nel.org>
To: Kevin Brodsky <kevin.brodsky@....com>, linux-mm@...ck.org,
linux-kselftest@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Andrew Morton <akpm@...ux-foundation.org>,
Dev Jain <dev.jain@....com>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Mark Brown <broonie@...nel.org>, Ryan Roberts <ryan.roberts@....com>,
Shuah Khan <shuah@...nel.org>
Subject: Re: [PATCH v3 5/9] selftests/mm: check that FORCE_READ() succeeded
On 1/22/26 18:02, Kevin Brodsky wrote:
> Many cow tests rely on FORCE_READ() to populate pages. Introduce a
> helper to make sure that the pages are actually populated, and fail
> otherwise.
>
> Suggested-by: David Hildenbrand (Red Hat) <david@...nel.org>
> Signed-off-by: Kevin Brodsky <kevin.brodsky@....com>
> ---
> tools/testing/selftests/mm/cow.c | 43 ++++++++++++++++++++++++--------
> 1 file changed, 33 insertions(+), 10 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
> index 83b3563be26b..d9c69c04b67d 100644
> --- a/tools/testing/selftests/mm/cow.c
> +++ b/tools/testing/selftests/mm/cow.c
> @@ -75,6 +75,18 @@ static bool range_is_swapped(void *addr, size_t size)
> return true;
> }
>
> +static bool populate_page_checked(char *addr)
> +{
> + bool ret;
> +
> + FORCE_READ(*addr);
> + ret = pagemap_is_populated(pagemap_fd, addr);
> + if (!ret)
> + ksft_print_msg("Failed to populate page\n");
> +
> + return ret;
> +}
LGTM.
On second thought, this primarily catches if someone breaks FORCE_READ()
... which hopefully doesn't happen that often? ;)
Because if the read succeeded, surely there must be something in the
page tables.
--
Cheers
David
Powered by blists - more mailing lists