Skip to content

Commit b433ffa

Browse files
PacheNicoakpm00
authored andcommitted
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/[email protected] Signed-off-by: Nico Pache <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 6ca03f1 commit b433ffa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tools/testing/selftests/mm/run_vmtests.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,15 @@ pretty_name() {
206206
# Usage: run_test [test binary] [arbitrary test arguments...]
207207
run_test() {
208208
if test_selected ${CATEGORY}; then
209+
# On memory constrainted systems some tests can fail to allocate hugepages.
210+
# perform some cleanup before the test for a higher success rate.
211+
if [ ${CATEGORY} == "thp" ] | [ ${CATEGORY} == "hugetlb" ]; then
212+
echo 3 > /proc/sys/vm/drop_caches
213+
sleep 2
214+
echo 1 > /proc/sys/vm/compact_memory
215+
sleep 2
216+
fi
217+
209218
local test=$(pretty_name "$*")
210219
local title="running $*"
211220
local sep=$(echo -n "$title" | tr "[:graph:][:space:]" -)

0 commit comments

Comments
 (0)