linux/tools/testing/selftests/vm
Feng Tang 09b18c2435 selftests/mm: compaction_test: support platform with huge mount of memory
commit ab00ddd802 upstream.

When running mm selftest to verify mm patches, 'compaction_test' case
failed on an x86 server with 1TB memory.  And the root cause is that it
has too much free memory than what the test supports.

The test case tries to allocate 100000 huge pages, which is about 200 GB
for that x86 server, and when it succeeds, it expects it's large than 1/3
of 80% of the free memory in system.  This logic only works for platform
with 750 GB ( 200 / (1/3) / 80% ) or less free memory, and may raise false
alarm for others.

Fix it by changing the fixed page number to self-adjustable number
according to the real number of free memory.

Link: https://lkml.kernel.org/r/20250423103645.2758-1-feng.tang@linux.alibaba.com
Fixes: bd67d5c15c ("Test compaction of mlocked memory")
Signed-off-by: Feng Tang <feng.tang@linux.alibaba.com>
Acked-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Tested-by: Baolin Wang <baolin.wang@inux.alibaba.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Sri Jayaramappa <sjayaram@akamai.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-05-22 14:10:08 +02:00
..
.gitignore selftest: vm: remove deleted local_config.* from .gitignore 2022-09-11 20:26:10 -07:00
charge_reserved_hugetlb.sh selftests/mm: generate a temporary mountpoint for cgroup filesystem 2025-05-02 07:46:53 +02:00
compaction_test.c selftests/mm: compaction_test: support platform with huge mount of memory 2025-05-22 14:10:08 +02:00
config selftests: vm: add test for Soft-Dirty PTE bit 2022-04-28 23:16:11 -07:00
gup_test.c selftests/vm: use top_srcdir instead of recomputing relative paths 2022-10-05 11:05:17 -06:00
hmm-tests.c selftests/mm: fix incorrect buffer->mirror size in hmm2 double_map test 2024-11-08 16:26:39 +01:00
hugepage-mmap.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hugepage-mremap.c selftest/vm: uninitialized variable in main() 2022-07-29 18:07:17 -07:00
hugepage-shm.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hugepage-vmemmap.c selftests: vm: add a hugetlb test case 2022-03-22 15:57:08 -07:00
hugetlb-madvise.c tools/testing/selftests/vm/hugetlb-madvise.c: silence uninitialized variable warning 2022-07-29 18:07:16 -07:00
hugetlb_reparenting_test.sh selftests/mm: generate a temporary mountpoint for cgroup filesystem 2025-05-02 07:46:53 +02:00
khugepaged.c selftests/vm: add file/shmem MADV_COLLAPSE selftest for cleared pmd 2022-10-03 14:03:34 -07:00
ksm_tests.c selftests/mm: ksm_tests should only MADV_HUGEPAGE valid memory 2024-02-23 09:12:48 +01:00
madv_populate.c selftests: vm: bring common functions to a new file 2022-04-28 23:16:11 -07:00
Makefile selftests: vm: Fix incorrect kernel headers search path 2023-03-10 09:34:18 +01:00
map_fixed_noreplace.c selftest/vm: fix map_fixed_noreplace test failure 2022-02-26 09:51:17 -08:00
map_hugetlb.c selftests: mm: fix map_hugetlb failure on 64K page size systems 2024-03-15 10:48:20 -04:00
map_populate.c tools/testing/selftests/vm/: add MAP_POPULATE test 2018-08-22 10:52:45 -07:00
memfd_secret.c selftests: secretmem: floor the memory size to the multiple of page_size 2024-01-10 17:10:26 +01:00
migration.c mm: add selftests for migration entries 2022-04-28 23:16:07 -07:00
mlock-random-test.c selftests: Fix spelling mistake "cann't" -> "cannot" 2021-09-03 09:58:13 -07:00
mlock2-tests.c selftests: vm: drop dependencies on page flags from mlock2 tests 2020-04-02 09:35:31 -07:00
mlock2.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mrelease_test.c selftests/vm: fix errno handling in mrelease_test 2022-07-29 18:07:14 -07:00
mremap_dontunmap.c selftests: add a MREMAP_DONTUNMAP selftest for shmem 2021-04-30 11:20:39 -07:00
mremap_test.c mm: add merging after mremap resize 2022-09-26 19:46:28 -07:00
on-fault-limit.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pkey-helpers.h selftests/vm: remove ARRAY_SIZE define from individual tests 2021-12-10 17:51:25 -07:00
pkey-powerpc.h selftests: vm: pkeys: use the correct page size on powerpc 2020-06-04 19:06:27 -07:00
pkey-x86.h selftests/vm/pkeys: Add a regression test for setting PKRU through ptrace 2023-01-14 10:33:42 +01:00
protection_keys.c selftests/vm/pkeys: Add a regression test for setting PKRU through ptrace 2023-01-14 10:33:42 +01:00
run_vmtests.sh selftests: vm: add /dev/userfaultfd test cases to run_vmtests.sh 2022-09-11 20:25:49 -07:00
settings selftests: vm: add the "settings" file with timeout variable 2022-05-25 10:47:49 -07:00
soft-dirty.c selftests/vm: dedup THP helpers 2022-10-03 14:03:34 -07:00
split_huge_page_test.c selftests/vm: dedup THP helpers 2022-10-03 14:03:34 -07:00
test_hmm.sh mm/hmm/test: use char dev with struct device to get device node 2022-10-03 14:03:03 -07:00
test_vmalloc.sh vm/test_vmalloc.sh: adapt for updated driver interface 2021-04-30 11:20:40 -07:00
thuge-gen.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
transhuge-stress.c selftest/vm: add util.h and and move helper functions there 2022-03-24 19:06:45 -07:00
userfaultfd.c mm/selftest: uffd: explain the write missing fault check 2022-10-12 18:51:50 -07:00
util.h selftest/vm: add helpers to detect PAGE_SIZE and PAGE_SHIFT 2022-03-24 19:06:45 -07:00
va_128TBswitch.c selftests/vm: skip 128TBswitch on unsupported arch 2022-07-29 18:07:14 -07:00
va_128TBswitch.sh selftests/mm: Update va_high_addr_switch.sh to check CPU for la57 flag 2024-02-23 09:12:48 +01:00
virtual_address_range.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 191 2019-05-30 11:29:21 -07:00
vm_util.c selftests/vm: add thp collapse file and tmpfs testing 2022-10-03 14:03:34 -07:00
vm_util.h selftests/vm: add thp collapse file and tmpfs testing 2022-10-03 14:03:34 -07:00
write_hugetlb_memory.sh selftests/mm: switch to bash from sh 2024-03-15 10:48:20 -04:00
write_to_hugetlbfs.c selftests/mm: fix charge_reserved_hugetlb.sh test 2024-10-17 15:21:49 +02:00