summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Pache <npache@redhat.com>2024-01-17 21:00:37 +0300
committerAndrew Morton <akpm@linux-foundation.org>2024-02-22 21:24:39 +0300
commitb433ffa8dbacbc5fddd6a110c4a23d0d711a6e74 (patch)
tree68491ee0480c62d2696e5f480bd357dabc9ddcd7
parent6ca03f1bb5a7427a66df62c954b3500a4255cdb9 (diff)
downloadlinux-b433ffa8dbacbc5fddd6a110c4a23d0d711a6e74.tar.xz
selftests: mm: perform some system cleanup before using hugepages
When running with CATEGORY= (thp | hugetlb) we see a large numbers of tests failing. These failures are due to not being able to allocate a hugepage and normally occur on memory contrainted systems or when using large page sizes. drop_cache and compact_memory before the tests for a higher chance at a successful hugepage allocation. Link: https://lkml.kernel.org/r/20240117180037.15734-1-npache@redhat.com Signed-off-by: Nico Pache <npache@redhat.com> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rwxr-xr-xtools/testing/selftests/mm/run_vmtests.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
index 246d53a5d7f2..040f27e21f47 100755
--- a/tools/testing/selftests/mm/run_vmtests.sh
+++ b/tools/testing/selftests/mm/run_vmtests.sh
@@ -206,6 +206,15 @@ pretty_name() {
# Usage: run_test [test binary] [arbitrary test arguments...]
run_test() {
if test_selected ${CATEGORY}; then
+ # On memory constrainted systems some tests can fail to allocate hugepages.
+ # perform some cleanup before the test for a higher success rate.
+ if [ ${CATEGORY} == "thp" ] | [ ${CATEGORY} == "hugetlb" ]; then
+ echo 3 > /proc/sys/vm/drop_caches
+ sleep 2
+ echo 1 > /proc/sys/vm/compact_memory
+ sleep 2
+ fi
+
local test=$(pretty_name "$*")
local title="running $*"
local sep=$(echo -n "$title" | tr "[:graph:][:space:]" -)