Commit 0a7dc82e authored by Mathieu Desnoyers's avatar Mathieu Desnoyers Committed by Shuah Khan

rseq/selftests: Adapt number of threads to the number of detected cpus

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: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Joel Fernandes <joelaf@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Watson <davejwatson@fb.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: linux-kselftest@vger.kernel.org
Cc: "H . Peter Anvin" <hpa@zytor.com>
Cc: Chris Lameter <cl@linux.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Paul Turner <pjt@google.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ben Maurer <bmaurer@fb.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarShuah Khan <shuah@kernel.org>
parent 0b0600c8
#!/bin/bash #!/bin/bash
# SPDX-License-Identifier: GPL-2.0+ or MIT # SPDX-License-Identifier: GPL-2.0+ or MIT
NR_CPUS=`grep '^processor' /proc/cpuinfo | wc -l`
EXTRA_ARGS=${@} EXTRA_ARGS=${@}
OLDIFS="$IFS" OLDIFS="$IFS"
...@@ -28,15 +30,16 @@ IFS="$OLDIFS" ...@@ -28,15 +30,16 @@ IFS="$OLDIFS"
REPS=1000 REPS=1000
SLOW_REPS=100 SLOW_REPS=100
NR_THREADS=$((6*${NR_CPUS}))
function do_tests() function do_tests()
{ {
local i=0 local i=0
while [ "$i" -lt "${#TEST_LIST[@]}" ]; do while [ "$i" -lt "${#TEST_LIST[@]}" ]; do
echo "Running test ${TEST_NAME[$i]}" 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]}" 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++" let "i++"
done done
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment