Re: [PATCH v2 01/13] selftests/mm: restore default nr_hugepages value during cleanup in charge_reserved_hugetlb.sh

David Hildenbrand (Arm)
2026-03-12T12:43:47Z

On 3/12/26 13:25, Sayali Patil wrote:
> During cleanup, the value of /proc/sys/vm/nr_hugepages is currently being
> set to 0. At the end of the test, if all tests pass, the original
> nr_hugepages value is restored. However, if any test fails, it remains
> set to 0.
> With this patch, we ensure that the original nr_hugepages value is
> restored during cleanup, regardless of whether the test passes or fails.
>
> Fixes: 7d695b1c3695b ("selftests/mm: save and restore nr_hugepages value")
> Reviewed-by: Zi Yan <ziy@nvidia.com>
> Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
> ---
> 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 447769657634..c9fe68b6fcf9 100755
> --- a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
> +++ b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
> @@ -65,7 +65,7 @@ function cleanup() {
> if [[ -e $cgroup_path/hugetlb_cgroup_test2 ]]; then
> rmdir $cgroup_path/hugetlb_cgroup_test2
> fi
> - echo 0 >/proc/sys/vm/nr_hugepages
> + echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages
> echo CLEANUP DONE
> }
>

Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>

--
Cheers,

David