On Tue, Jan 09, 2024 at 09:47:31PM -0800, Andrew Morton wrote: > On Fri, 5 Jan 2024 07:54:19 -0800 Breno Leitao <leitao@xxxxxxxxxx> wrote: > > > This test stresses the race between of madvise(DONTNEED), a page fault > > and a parallel huge page mmap, which should fail due to lack of > > available page available for mapping. > > > > This test case must run on a system with one and only one huge page > > available. > > > > # echo 1 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages > > Can't the test framework perform this configuration prior to running > the test? We have this infrastructure already set in the run_vmtest.sh. The "hugetlb_fault_after_madv" selftest needs the same configuration, so, once the fix is ready, we will just add something as: --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -227,6 +227,7 @@ 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 +CATEGORY="hugetlb" run_test ./hugetlb_madv_vs_map # Restore the previous number of huge pages, since further tests rely on it echo "$nr_hugepages_tmp" > /proc/sys/vm/nr_hugepages