Re: [PATCH] selftests/mm: pagemap_ioctl: use the correct page size for transact_test()

From: Andrew Morton

Date: Sun Jun 28 2026 - 14:13:36 EST


On Sun, 28 Jun 2026 18:11:18 +0800 Zenghui Yu <zenghui.yu@xxxxxxxxx> wrote:

> There are several places in transact_test() where we use the hardcoded
> 0x1000 (4k) as page size, which is not always correct for architectures
> supporting multiple page sizes.

doh.

> Switch to use the correct page size. Otherwise ./ksft_pagemap.sh on a
> 16k-page-size arm64 box fails with
>
> $ ./ksft_pagemap.sh
> [...]
> # ok 96 mprotect_tests Both pages written after remap and mprotect
> # ok 97 mprotect_tests Clear and make the pages written
> # Bail out! ioctl failed
> # # Planned tests != run tests (117 != 97)
> # # Totals: pass:97 fail:0 xfail:0 xpass:0 skip:0 error:0
> # [FAIL]
> not ok 1 pagemap_ioctl # exit=1
> # SUMMARY: PASS=0 SKIP=0 FAIL=1
> 1..1

Thanks. I'll add a cc:stable to this.

> tools/testing/selftests/mm/pagemap_ioctl.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)

I'd like to see this code initialize page_size and hpage_size before
calling init_uffd(), hugetlb_setup_default(), etc. That won't fix
anything but it's safer and saner to get these globals set up before
doing other things.