[LTP] [PATCH v4 0/3] hugemmap10: Account for memory policy in counter checks

Huaisheng Ye yehuaisheng@open-hieco.net
Mon Oct 26 08:07:29 CET 2026


The hugetlb reservation fix allocates surplus hugepages when global free
pages are outside nodes allowed by the current cpuset and MPOL_BIND policy.
This series updates hugemmap10's global counter expectations to match that
behavior.

Patch 1 fixes mappings that create their reservation at mmap() time. Patches
2 and 3 add and validate a MAP_NORESERVE private-mapping mode, which lets the
test exercise fault-time allocation without booting a kernel that lacks
private mmap-time reservations.

Changes in v4:
- Rebase onto 05aebc377 ("sys_hwmon01: always report a result").
- Preserve the memory policy mode flags and resolve MPOL_F_RELATIVE_NODES
  masks against the current allowed memory nodes using nodes_fold() and
  nodes_onto() semantics before checking overlap or counting free pages.
- Give hugemmap10 -n the distinct runtest identifier hugemmap10_noreserve
  so session restore and reboot recovery track both invocations separately.
- Correct comments and commit messages to describe MAP_NORESERVE faults as
  allocating unreserved hugepages, without creating a mapping reservation
  or changing HugePages_Rsvd.
- Collect Reviewed-by in 2/3.

Changes in v3:
- Rebase onto 113594f53 ("hugemmap10: Treat fd 0 as valid in cleanup").
- Add hugemmap10 -n to runtest/hugetlb so the default suite exercises the
  private fault-time allocation path.
- Remove the redundant private_noreserve variable and use
  private_noreserve_opt directly to detect -n.
- Define MAP_TYPE in lapi/mmap.h when libc headers lack it, and include
  that header in hugemmap10.c.
- Collect Reviewed-by in 1/3 and 3/3.

Tested on an eight-node system running v7.3, with cpuset
{3,5,6}: both default and -n invocations pass with relative MPOL_BIND {1,2}
and ordinary MPOL_BIND {5,6}. An additional -n run with relative {0,4}
also passes, exercising folding to physical nodes {3,5}.

v3: https://lore.kernel.org/all/20261010095155.117953-2-yehuaisheng@open-hieco.net/
v2: https://lore.kernel.org/all/20260929072412.20979-1-yehuaisheng@open-hieco.net/

Huaisheng Ye (3):
  hugemmap10: Account for memory policy in mmap counter checks
  hugemmap10: Add private MAP_NORESERVE test mode
  hugemmap10: Account for memory policy in private fault checks

 include/lapi/mmap.h                           |   4 +
 runtest/hugetlb                               |   1 +
 .../kernel/mem/hugetlb/hugemmap/hugemmap10.c  | 194 ++++++++++++++++--
 3 files changed, 184 insertions(+), 15 deletions(-)

-- 
2.52.0


More information about the ltp mailing list