On Fri, 26 Jun 2026 20:59:02 +0800 "Yijia Wang" <[email protected]> wrote:
> The hugetlb mincore test passes the base page size as the MAP_HUGETLB > mapping length. This works on systems where the default huge page size > is the same as the base page size, but mmap() can fail with EINVAL before > mincore() is exercised when the default huge page size is larger, such as > on arm64 systems with 64K base pages and 2M huge pages. > > Use the default huge page size from /proc/meminfo for the hugetlb mapping > and unmap length. Keep the mincore() check scoped to one base page since > the test only needs to verify the residency state before and after the > mapping is touched. This also avoids changing the mincore() length to the > whole huge page, which would require a larger residency vector because > mincore() reports one byte per base page. Thanks. AI review flagged a couple of possible issues - can you please take a look? https://sashiko.dev/#/patchset/[email protected] > --- a/tools/testing/selftests/mincore/mincore_selftest.c > +++ b/tools/testing/selftests/mincore/mincore_selftest.c > @@ -22,6 +22,27 @@ > #define MB (1UL << 20) > #define FILE_SIZE (4 * MB) > > +static unsigned long default_huge_page_size(void) This would be our fifth(?) implementation of default_huge_page_size() in tools/testing/selftests. There's a project for someone!

