From: Li Wang <li.wang@linux.dev>
To: Huaisheng Ye <yehuaisheng@open-hieco.net>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 1/3] hugemmap10: Account for memory policy in mmap counter checks
Date: Thu, 8 Oct 2026 16:26:39 +0800 [thread overview]
Message-ID: <asdTv0UIAtgrPLs3@linux.dev> (raw)
In-Reply-To: <20260929072412.20979-2-yehuaisheng@open-hieco.net>
Huaisheng Ye wrote:
> Expected surplus accounting for mappings that reserve at mmap() time only
> considers the global free and reserved hugepage counters. But sometimes,
> for instance with MPOL_BIND, globally free hugepages can reside outside
> nodes from which the task can allocate or plans to allocate. Hugetlb
> then creates surplus pages on allowed nodes, while the test expects
> no counter change.
>
> For example, reproduce this on an eight-node system running 7.3.0-rc1:
>
> $ numactl --membind=0-3 ./hugemmap10
> tst_hugepage.c:84: TINFO: 3 hugepage(s) reserved
> ...
> hugemmap10.c:386: TINFO: Base pool size: 0
> hugemmap10.c:313: TINFO: Clean...
> hugemmap10.c:364: TINFO: OK
> hugemmap10.c:313: TINFO: Untouched, shared...
> hugemmap10.c:364: TINFO: OK
> hugemmap10.c:313: TINFO: Untouched, private...
> hugemmap10.c:364: TINFO: OK
> hugemmap10.c:313: TINFO: Touched, shared...
> hugemmap10.c:364: TINFO: OK
> hugemmap10.c:313: TINFO: Touched, private...
> hugemmap10.c:364: TINFO: OK
> hugemmap10.c:386: TINFO: Base pool size: 1
> hugemmap10.c:313: TINFO: Clean...
> hugemmap10.c:319: TFAIL: While doing mmap shared with no touch: Bad HugePages_Total: expected 1, actual 2
> hugemmap10.c:319: TFAIL: While doing mmap shared with no touch: Bad HugePages_Free: expected 1, actual 2
> hugemmap10.c:319: TFAIL: While doing mmap shared with no touch: Bad HugePages_Surp: expected 0, actual 1
>
> Summary:
> passed 0
> failed 3
> broken 0
> skipped 0
> warnings 0
>
> $ numactl --membind=4-7 ./hugemmap10
> ...
> hugemmap10.c:364: TINFO: OK
> hugemmap10.c:429: TPASS: Hugepages Counters works as expected.
>
> Summary:
> passed 1
> failed 0
> broken 0
> skipped 0
> warnings 0
>
> If global free hugepages are on nodes 4-7 while the memory policy restricts
> hugemmap10 to nodes 0-3, the counter discrepancy is observed.
>
> Read the task policy and cpuset mask, then sum free hugepages on the
> nodes available to the mapping. Calculate the expected surplus as the
> maximum of the global and allowed-node shortfalls. Match hugetlb's fallback
> to the cpuset when an MPOL_BIND mask no longer intersects it.
>
> This fixes counter expectations for MAP_SHARED and MAP_PRIVATE mappings
> that create reservations at mmap() time.
>
> This complements the hugetlb reservation fix:
> https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/commit/?h=mm-new&id=506f9bf248c092fc80df046f9deb26094ea84592
>
> Signed-off-by: Huaisheng Ye <yehuaisheng@open-hieco.net>
Reviewed-by: Li Wang <li.wang@linux.dev>
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-10-08 8:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 7:24 [LTP] [PATCH v2 0/3] hugemmap10: Account for memory policy in counter checks Huaisheng Ye
2026-09-29 7:24 ` [LTP] [PATCH v2 1/3] hugemmap10: Account for memory policy in mmap " Huaisheng Ye
2026-09-29 11:18 ` [LTP] " linuxtestproject.agent
2026-10-08 8:26 ` Li Wang [this message]
2026-09-29 7:24 ` [LTP] [PATCH v2 2/3] hugemmap10: Add private MAP_NORESERVE test mode Huaisheng Ye
2026-10-08 9:09 ` Li Wang
2026-09-29 7:24 ` [LTP] [PATCH v2 3/3] hugemmap10: Account for memory policy in private fault checks Huaisheng Ye
2026-10-08 9:40 ` Li Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=asdTv0UIAtgrPLs3@linux.dev \
--to=li.wang@linux.dev \
--cc=ltp@lists.linux.it \
--cc=yehuaisheng@open-hieco.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox