On smaller systems, running a test with 200 threads can take a long
time on machines with smaller number of CPUs.

Detect the number of online cpus at test runtime, and multiply that
by 6 to have 6 rseq threads per cpu preempting each other.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
Cc: Shuah Khan <sh...@kernel.org>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Joel Fernandes <joe...@google.com>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Catalin Marinas <catalin.mari...@arm.com>
Cc: Dave Watson <davejwat...@fb.com>
Cc: Will Deacon <will.dea...@arm.com>
Cc: Andi Kleen <a...@firstfloor.org>
Cc: linux-kselft...@vger.kernel.org
Cc: "H . Peter Anvin" <h...@zytor.com>
Cc: Chris Lameter <c...@linux.com>
Cc: Russell King <li...@arm.linux.org.uk>
Cc: Michael Kerrisk <mtk.manpa...@gmail.com>
Cc: "Paul E . McKenney" <paul...@linux.vnet.ibm.com>
Cc: Paul Turner <p...@google.com>
Cc: Boqun Feng <boqun.f...@gmail.com>
Cc: Josh Triplett <j...@joshtriplett.org>
Cc: Steven Rostedt <rost...@goodmis.org>
Cc: Ben Maurer <bmau...@fb.com>
Cc: Andy Lutomirski <l...@amacapital.net>
Cc: Andrew Morton <a...@linux-foundation.org>
Cc: Linus Torvalds <torva...@linux-foundation.org>
---
 tools/testing/selftests/rseq/run_param_test.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/rseq/run_param_test.sh 
b/tools/testing/selftests/rseq/run_param_test.sh
index 3acd6d75ff9f..e426304fd4a0 100755
--- a/tools/testing/selftests/rseq/run_param_test.sh
+++ b/tools/testing/selftests/rseq/run_param_test.sh
@@ -1,6 +1,8 @@
 #!/bin/bash
 # SPDX-License-Identifier: GPL-2.0+ or MIT
 
+NR_CPUS=`grep '^processor' /proc/cpuinfo | wc -l`
+
 EXTRA_ARGS=${@}
 
 OLDIFS="$IFS"
@@ -28,15 +30,16 @@ IFS="$OLDIFS"
 
 REPS=1000
 SLOW_REPS=100
+NR_THREADS=$((6*${NR_CPUS}))
 
 function do_tests()
 {
        local i=0
        while [ "$i" -lt "${#TEST_LIST[@]}" ]; do
                echo "Running test ${TEST_NAME[$i]}"
-               ./param_test ${TEST_LIST[$i]} -r ${REPS} ${@} ${EXTRA_ARGS} || 
exit 1
+               ./param_test ${TEST_LIST[$i]} -r ${REPS} -t ${NR_THREADS} ${@} 
${EXTRA_ARGS} || exit 1
                echo "Running compare-twice test ${TEST_NAME[$i]}"
-               ./param_test_compare_twice ${TEST_LIST[$i]} -r ${REPS} ${@} 
${EXTRA_ARGS} || exit 1
+               ./param_test_compare_twice ${TEST_LIST[$i]} -r ${REPS} -t 
${NR_THREADS} ${@} ${EXTRA_ARGS} || exit 1
                let "i++"
        done
 }
-- 
2.11.0

Reply via email to