Skip to content

Commit dd9b35e

Browse files
leitaoakpm00
authored andcommitted
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/20231103173400.1608403-1-leitao@debian.org Fixes: 116d573 ("selftests/mm: add a new test for madv and hugetlb") Signed-off-by: Breno Leitao <leitao@debian.org> Reported-by: Ryan Roberts <ryan.roberts@arm.com> Closes: https://lore.kernel.org/all/662df57e-47f1-4c15-9b84-f2f2d587fc5c@arm.com/ Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 9297e53 commit dd9b35e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

tools/testing/selftests/mm/run_vmtests.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,12 @@ CATEGORY="hugetlb" run_test ./hugepage-mremap
223223
CATEGORY="hugetlb" run_test ./hugepage-vmemmap
224224
CATEGORY="hugetlb" run_test ./hugetlb-madvise
225225

226+
nr_hugepages_tmp=$(cat /proc/sys/vm/nr_hugepages)
226227
# For this test, we need one and just one huge page
227228
echo 1 > /proc/sys/vm/nr_hugepages
228229
CATEGORY="hugetlb" run_test ./hugetlb_fault_after_madv
230+
# Restore the previous number of huge pages, since further tests rely on it
231+
echo "$nr_hugepages_tmp" > /proc/sys/vm/nr_hugepages
229232

230233
if test_selected "hugetlb"; then
231234
echo "NOTE: These hugetlb tests provide minimal coverage. Use"

0 commit comments

Comments
 (0)