Re: [PATCH 2/2] selftests/mm: restore hidden hugetlb reservation scenarios

From: Kurt Lin

Date: Mon Nov 23 2026 - 10:10:13 EST


On Fri, Sep 04, 2026 at 11:30:23AM +0300, Mike Rapoport wrote:
> And this code breaks our CI e.g:
>
> https://github.com/linux-mm/linux-mm/actions/runs/33040981840/job/98414290236

The hugetlb category in that run hit its 300 s timeout inside
charge_reserved_hugetlb.sh.

With the stray 'continue' gone, the "more than reservation" and "more
than cgroup limit" cases run. They expect the write to fail, but
write_hugetlbfs_and_get_usage() still waits for the full reservation,
so most of these cases spend 60 s in wait_for_file_value() before
moving on. The CI log shows this: hugetlb.2MB.rsvd.current stays at 0
for 60 polls in three cases, and the run is killed during the fourth.

Skipping the wait when a failure is expected, on top of this patch:

--- 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

takes the script from over 600 s to 64 s in a virtme-ng guest, with
all 56 cases passing (only 28 ran before), and run_vmtests.sh -t
hugetlb to 83 s.

Song, would you like to fold this into a v2, or should I send it as a
separate patch?

I found and tested this with the help of an AI coding assistant.