[LTP] [PATCH v2 1/3] hugemmap10: Add linux-git tag for NUMA fix

Huaisheng Ye yehuaisheng@open-hieco.net
Mon Nov 23 09:05:35 CET 2026


Tag Linux commit 21f514ad5204 ("mm/hugetlb: account for allowed nodes
when gathering surplus pages"), which fixes hugetlb mappings when free
huge pages are outside the nodes allowed by the task's cpuset or
MPOL_BIND policy.

Before the fix, gather_surplus_pages() considered only global counters.
As a result, mmap() could fail with ENOMEM even when
nr_overcommit_hugepages allowed surplus pages on the permitted nodes.

Put the regression description and NUMA reproduction command in the
existing documentation comment so both are exported to documentation.

Signed-off-by: Huaisheng Ye <yehuaisheng@open-hieco.net>
---
 .../kernel/mem/hugetlb/hugemmap/hugemmap10.c     | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap10.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap10.c
index c66b07039..763f68e69 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap10.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap10.c
@@ -10,6 +10,18 @@
  * Hugetlb counter (Total, Free, Reserve, Surplus) in /proc/meminfo and
  * compare them with expected (calculated) value. if all checks are
  * successful, the test passes.
+ *
+ * This test also covers the NUMA regression fixed by Linux commit
+ * 21f514ad520459fbfa58ccdf171bb68148c2f5aa. If free huge pages are outside
+ * the nodes allowed by the task's cpuset or MPOL_BIND policy, hugetlb must
+ * account for the allowed-node shortfall when gathering surplus pages.
+ * Otherwise mmap() may fail with ENOMEM even when nr_overcommit_hugepages
+ * permits allocating surplus pages on the allowed nodes.
+ *
+ * The issue can be exercised on a system with two or more NUMA nodes, for
+ * example with::
+ *
+ *     numactl --cpunodebind=0 --membind=1 ./hugemmap10
  */
 
 #define _GNU_SOURCE
@@ -602,6 +614,10 @@ static void cleanup(void)
 }
 
 static struct tst_test test = {
+	.tags = (struct tst_tag[]) {
+		{"linux-git", "21f514ad520459fbfa58ccdf171bb68148c2f5aa"},
+		{}
+	},
 	.needs_root = 1,
 	.options = (struct tst_option[]) {
 		{"n", &private_noreserve_opt,
-- 
2.52.0



More information about the ltp mailing list