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

From: Andrew Morton

Date: Tue Sep 01 2026 - 20:38:18 EST


On Tue, 14 Jul 2026 10:16:30 +0800 Song Hu <husong@xxxxxxxxxx> wrote:

> A stray 'continue' in the main loop of charge_reserved_hugetlb.sh made
> the "more than reservation", "more than cgroup limit", and "multiple
> cgroups" scenarios unreachable, so they never ran.
>
> Remove it so the first two run again.

OK.

> The third,
> run_multiple_cgroup_test(), is separately broken -- a backslash
> line-continuation breaks its local declarations and its hugetlb
> reservation accounting does not charge as expected -- and has never run
> in CI; skip it explicitly with a comment until fixed.

That's reasonable. This code was added by Mina six years ago. But
he's still around so let's bug him with a cc ;)

> Also correct two
> `[[ "$method" == 2"" ]]` typos (harmless empty-string concatenation)
> to plain `2`.

OK.



From: Song Hu <husong@xxxxxxxxxx>
Subject: selftests/mm: restore hidden hugetlb reservation scenarios
Date: Tue, 14 Jul 2026 10:16:30 +0800

A stray 'continue' in the main loop of charge_reserved_hugetlb.sh made the
"more than reservation", "more than cgroup limit", and "multiple cgroups"
scenarios unreachable, so they never ran.

Remove it so the first two run again. The third,
run_multiple_cgroup_test(), is separately broken -- a backslash
line-continuation breaks its local declarations and its hugetlb
reservation accounting does not charge as expected -- and has never run in
CI; skip it explicitly with a comment until fixed. Also correct two `[[
"$method" == 2"" ]]` typos (harmless empty-string concatenation) to plain
`2`.

Link: https://lore.kernel.org/20260714021630.1063823-1-husong@xxxxxxxxxx
Signed-off-by: Song Hu <husong@xxxxxxxxxx>
Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: David Hildenbrand <david@xxxxxxxxxx>
Cc: Liam R. Howlett <liam@xxxxxxxxxxxxx>
Cc: Lorenzo Stoakes <ljs@xxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>
Cc: Mike Rapoport <rppt@xxxxxxxxxx>
Cc: Muchun Song <muchun.song@xxxxxxxxx>
Cc: Oscar Salvador <osalvador@xxxxxxx>
Cc: Shuah Khan <shuah@xxxxxxxxxx>
Cc: Suren Baghdasaryan <surenb@xxxxxxxxxx>
Cc: Vlastimil Babka <vbabka@xxxxxxxxxx>
Cc: Mina Almasry <almasrymina@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

tools/testing/selftests/mm/charge_reserved_hugetlb.sh | 14 +++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

--- a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh~selftests-mm-restore-hidden-hugetlb-reservation-scenarios
+++ a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
@@ -439,11 +439,11 @@ for populate in "" "-o"; do
fi

# Skip populated shmem tests. Doesn't seem to be supported.
- if [[ "$method" == 2"" ]] && [[ "$populate" == "-o" ]]; then
+ if [[ "$method" == 2 ]] && [[ "$populate" == "-o" ]]; then
continue
fi

- if [[ "$method" == 2"" ]] && [[ "$reserve" == "-n" ]]; then
+ if [[ "$method" == 2 ]] && [[ "$reserve" == "-n" ]]; then
continue
fi

@@ -496,7 +496,6 @@ for populate in "" "-o"; do
echo 'PASS'

cleanup
- continue
echo
echo
echo
@@ -530,6 +529,15 @@ for populate in "" "-o"; do

cleanup

+ # The "multiple cgroups" scenario (run_multiple_cgroup_test) is
+ # multiply broken and has never run in CI: a backslash
+ # line-continuation breaks its local declarations, it passes
+ # reservation sizes in bytes rather than pages (unlike
+ # run_test), and its assertions compare page counts to byte
+ # values. Skip it until properly rewritten; the two scenarios
+ # above are restored by this change.
+ continue
+
echo
echo
echo
_