Re: [PATCH 2/3] selftests/mm: hmm-tests: don't hardcode THP size to 2MB
From: Balbir Singh
Date: Tue Mar 31 2026 - 04:59:10 EST
On 3/31/26 17:34, Alistair Popple wrote:
> Several HMM tests hardcode TWOMEG as the THP size. This is wrong on
> architectures where the PMD size is not 2MB such as arm64 with 64K base
> pages where THP is 512MB. Fix this by using read_pmd_pagesize() from
> vm_util instead.
>
> While here also replace the custom file_read_ulong() helper used to
> parse the default hugetlbfs page size from /proc/meminfo with the
> existing default_huge_page_size() from vm_util.
>
> [1] https://lore.kernel.org/linux-mm/8bd0396a-8997-4d2e-a13f-5aac033083d7@xxxxxxxxx/
>
> Fixes: fee9f6d1b8df ("mm/hmm/test: add selftests for HMM")
> Fixes: 519071529d2a ("selftests/mm/hmm-tests: new tests for zone device THP migration")
> Reported-by: Zenghui Yu <zenghui.yu@xxxxxxxxx>
> Closes: https://lore.kernel.org/linux-mm/8bd0396a-8997-4d2e-a13f-5aac033083d7@xxxxxxxxx/
> Signed-off-by: Alistair Popple <apopple@xxxxxxxxxx>
> ---
> tools/testing/selftests/mm/hmm-tests.c | 83 +++++---------------------
> 1 file changed, 16 insertions(+), 67 deletions(-)
>
Reviewed-by: Balbir Singh <balbirs@xxxxxxxxxx>