]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/mm: restore default nr_hugepages value during cleanup in hugetlb_reparentin...
authorDonet Tom <donettom@linux.ibm.com>
Thu, 10 Apr 2025 10:07:48 +0000 (05:07 -0500)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 May 2025 00:48:29 +0000 (17:48 -0700)
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.

Link: https://lkml.kernel.org/r/20250410100748.2310-1-donettom@linux.ibm.com
Fixes: 29750f71a9b4 ("hugetlb_cgroup: add hugetlb_cgroup reservation tests")
Signed-off-by: Donet Tom <donettom@linux.ibm.com>
Cc: Li Wang <liwang@redhat.com>
Cc: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Waiman Long <longman@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/hugetlb_reparenting_test.sh

index 9245549b66cfe96138b677e2182839bbbc7ec651..0dd31892ff679493811f528dac377e7f43a8e421 100755 (executable)
@@ -56,7 +56,7 @@ function cleanup() {
   rmdir "$CGROUP_ROOT"/a/b 2>/dev/null
   rmdir "$CGROUP_ROOT"/a 2>/dev/null
   rmdir "$CGROUP_ROOT"/test1 2>/dev/null
-  echo 0 >/proc/sys/vm/nr_hugepages
+  echo $nr_hugepgs >/proc/sys/vm/nr_hugepages
   set -e
 }