Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/mm: fix check for running THP tests

When testing if we should try to compact memory or drop caches before we
run the THP or HugeTLB tests we use | as an or operator. This doesn't
work since run_vmtests.sh is written in shell where this is used to pipe
the output of the first argument into the second. Instead use the shell's
-o operator.

Link: https://lkml.kernel.org/r/20250212-kselftest-mm-no-hugepages-v1-1-44702f538522@kernel.org
Fixes: b433ffa8dbac ("selftests: mm: perform some system cleanup before using hugepages")
Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Nico Pache <npache@redhat.com>
Cc: Mariano Pache <npache@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Mark Brown and committed by
Andrew Morton
5dcf52e2 6d7bc938

+1 -1
+1 -1
tools/testing/selftests/mm/run_vmtests.sh
··· 220 220 if test_selected ${CATEGORY}; then 221 221 # On memory constrainted systems some tests can fail to allocate hugepages. 222 222 # perform some cleanup before the test for a higher success rate. 223 - if [ ${CATEGORY} == "thp" ] | [ ${CATEGORY} == "hugetlb" ]; then 223 + if [ ${CATEGORY} == "thp" -o ${CATEGORY} == "hugetlb" ]; then 224 224 echo 3 > /proc/sys/vm/drop_caches 225 225 sleep 2 226 226 echo 1 > /proc/sys/vm/compact_memory