aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBreno Leitao <[email protected]>2023-11-03 10:33:59 -0700
committerAndrew Morton <[email protected]>2023-11-15 15:30:08 -0800
commitdd9b35efd719be242e227f9eebad1e50ea5c914f (patch)
tree7e9fa87624aad69c2be17ce8eb6c32c22191b6d3
parent9297e5360c3bd777f95d5146dbeda7fb9ba4273a (diff)
selftests/mm: restore number of hugepages
The test mm `hugetlb_fault_after_madv` selftest needs one and only one huge page to run, thus it sets `/proc/sys/vm/nr_hugepages` to 1. The problem is that further tests require the previous number of hugepages allocated in order to succeed. Save the number of huge pages before changing it, and restore it once the test finishes, so, further tests could run successfully. Link: https://lkml.kernel.org/r/[email protected] Fixes: 116d57303a05 ("selftests/mm: add a new test for madv and hugetlb") Signed-off-by: Breno Leitao <[email protected]> Reported-by: Ryan Roberts <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Andrew Morton <[email protected]>
-rwxr-xr-xtools/testing/selftests/mm/run_vmtests.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
index cc16f6ca8533..00757445278e 100755
--- a/tools/testing/selftests/mm/run_vmtests.sh
+++ b/tools/testing/selftests/mm/run_vmtests.sh
@@ -223,9 +223,12 @@ CATEGORY="hugetlb" run_test ./hugepage-mremap
CATEGORY="hugetlb" run_test ./hugepage-vmemmap
CATEGORY="hugetlb" run_test ./hugetlb-madvise
+nr_hugepages_tmp=$(cat /proc/sys/vm/nr_hugepages)
# For this test, we need one and just one huge page
echo 1 > /proc/sys/vm/nr_hugepages
CATEGORY="hugetlb" run_test ./hugetlb_fault_after_madv
+# Restore the previous number of huge pages, since further tests rely on it
+echo "$nr_hugepages_tmp" > /proc/sys/vm/nr_hugepages
if test_selected "hugetlb"; then
echo "NOTE: These hugetlb tests provide minimal coverage. Use"