[LTP] [PATCH v2 3/3] hugemmap10: Account for memory policy in private fault checks

Li Wang li.wang@linux.dev
Thu Oct 8 11:40:22 CEST 2026


Huaisheng Ye wrote:

> Kernels without private mmap-time reservations or with flags MAP_NORESERVE
> create the reservation when the private VMA first faults. With MPOL_BIND,
> globally free hugepages can be outside the allowed nodes, so this fault
> can create surplus pages even when the global counters appear sufficient.
> 
>     $ numactl --cpunodebind=0 --membind=2 ./hugemmap10 -n
>     tst_hugepage.c:84: TINFO: 3 hugepage(s) reserved
>     tst_tmpdir.c:308: TINFO: Using /tmp/LTP_hugdeSTgL as tmpdir (xfs filesystem)
>     tst_test.c:1218: TINFO: Mounting none to /tmp/LTP_hugdeSTgL/hugetlbfs fstyp=hugetlbfs flags=0
>     tst_test.c:2048: TINFO: LTP version: 20260529-237-g132c8b0a8
>     tst_test.c:2051: TINFO: Tested kernel: 7.3.0-rc1-test-32+ #33 SMP PREEMPT Mon Sep  7 11:50:02 CST 2026 x86_64
>     tst_kconfig.c:90: TINFO: Parsing kernel config '/proc/config.gz'
>     tst_test.c:1876: TINFO: Overall timeout per run is 0h 00m 30s
>     hugemmap10.c:498: TINFO: Base pool size: 0
>     hugemmap10.c:425: TINFO: Clean...
>     hugemmap10.c:476: TINFO: OK
>     hugemmap10.c:425: TINFO: Untouched, shared...
>     hugemmap10.c:476: TINFO: OK
>     hugemmap10.c:425: TINFO: Untouched, private...
>     hugemmap10.c:476: TINFO: OK
>     hugemmap10.c:425: TINFO: Touched, shared...
>     hugemmap10.c:476: TINFO: OK
>     hugemmap10.c:425: TINFO: Touched, private...
>     hugemmap10.c:476: TINFO: OK
>     hugemmap10.c:498: TINFO: Base pool size: 1
>     hugemmap10.c:425: TINFO: Clean...
>     hugemmap10.c:448: TFAIL: While touching the addr after mmap private: Bad HugePages_Total: expected 1, actual 2
>     hugemmap10.c:448: TFAIL: While touching the addr after mmap private: Bad HugePages_Free: expected 0, actual 1
>     hugemmap10.c:448: TFAIL: While touching the addr after mmap private: Bad HugePages_Surp: expected 0, actual 1
> 
>     Summary:
>     passed   0
>     failed   3
>     broken   0
>     skipped  0
>     warnings 0
> 
> Get free hugepages on allowed nodes before touching an unreserved
> private mapping and use the maximum of the global and allowed-node
> shortfalls to calculate the expected counters.
> 
> Signed-off-by: Huaisheng Ye <yehuaisheng@open-hieco.net>

Nice fix!

Reviewed-by: Li Wang <li.wang@linux.dev>

-- 
Regards,
Li Wang


More information about the ltp mailing list