Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests/mm: fix usage of FORCE_READ() in cow tests

Commit 5bbc2b785e63 ("selftests/mm: fix FORCE_READ to read input value
correctly") modified FORCE_READ() to take a value instead of a pointer.
It also changed most of the call sites accordingly, but missed many of
them in cow.c. In those cases, we ended up with the pointer itself being
read, not the memory it points to.

No failure occurred as a result, so it looks like the tests work just fine
without faulting in. However, the huge_zeropage tests explicitly check
that pages are populated, so those became skipped.

Convert all the remaining FORCE_READ() to fault in the mapped page, as was
originally intended. This allows the huge_zeropage tests to run again (3
tests in total).

Link: https://lkml.kernel.org/r/20260122170224.4056513-5-kevin.brodsky@arm.com
Fixes: 5bbc2b785e63 ("selftests/mm: fix FORCE_READ to read input value correctly")
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Acked-by: SeongJae Park <sj@kernel.org>
Reviewed-by: wang lian <lianux.mm@gmail.com>
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
Reviewed-by: Dev Jain <dev.jain@arm.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Usama Anjum <Usama.Anjum@arm.com>
Cc: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Kevin Brodsky and committed by
Andrew Morton
bce1dabd 7f532d19

+8 -8
+8 -8
tools/testing/selftests/mm/cow.c
··· 1612 1612 * the first sub-page and test if we get another sub-page populated 1613 1613 * automatically. 1614 1614 */ 1615 - FORCE_READ(mem); 1616 - FORCE_READ(smem); 1615 + FORCE_READ(*mem); 1616 + FORCE_READ(*smem); 1617 1617 if (!pagemap_is_populated(pagemap_fd, mem + pagesize) || 1618 1618 !pagemap_is_populated(pagemap_fd, smem + pagesize)) { 1619 1619 ksft_test_result_skip("Did not get THPs populated\n"); ··· 1663 1663 } 1664 1664 1665 1665 /* Fault the page in. */ 1666 - FORCE_READ(mem); 1667 - FORCE_READ(smem); 1666 + FORCE_READ(*mem); 1667 + FORCE_READ(*smem); 1668 1668 1669 1669 fn(mem, smem, pagesize); 1670 1670 munmap: ··· 1719 1719 } 1720 1720 1721 1721 /* Fault the page in. */ 1722 - FORCE_READ(mem); 1723 - FORCE_READ(smem); 1722 + FORCE_READ(*mem); 1723 + FORCE_READ(*smem); 1724 1724 1725 1725 fn(mem, smem, pagesize); 1726 1726 munmap: ··· 1773 1773 } 1774 1774 1775 1775 /* Fault the page in. */ 1776 - FORCE_READ(mem); 1777 - FORCE_READ(smem); 1776 + FORCE_READ(*mem); 1777 + FORCE_READ(*smem); 1778 1778 1779 1779 fn(mem, smem, hugetlbsize); 1780 1780 munmap: