[PATCH 1/4] selftests/mm: don't wait for a hugetlb reservation that is expected to fail

From: Kurt Lin

Date: Fri Dec 04 2026 - 12:32:34 EST


After a synchronous write, write_hugetlbfs_and_get_usage() waits for
the reservation usage to reach the requested size, even when the
reservation is expected to fail. That wait then times out after 60
seconds.

The "more than reservation" and "more than cgroup limit" cases, hidden
by a stray 'continue' today, take this path. When they were restored,
the hugetlb category of the linux-mm CI hit its 300 second timeout
after three such waits.

Only wait when the reservation is expected to succeed.

Signed-off-by: Kurt Lin <lylin1023@xxxxxxxxx>
---
tools/testing/selftests/mm/charge_reserved_hugetlb.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
index 65065b1377b2..043cc1b1eb5f 100755
--- a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
+++ b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
@@ -252,7 +252,7 @@ function write_hugetlbfs_and_get_usage() {
"$cgroup" "$path" "$method" "$private" "$reserve"
local write_result=$?

- if [[ "$reserve" != "-n" ]]; then
+ if [[ "$reserve" != "-n" ]] && [[ "$expect_failure" != 1 ]]; then
wait_for_hugetlb_memory_to_get_reserved "$cgroup" "$size"
fi
fi

--
2.56.1