summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/rcutorture/bin/cpus2use.sh
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.ibm.com>2019-05-12 03:59:52 +0300
committerPaul E. McKenney <paulmck@linux.ibm.com>2019-05-28 19:06:09 +0300
commit7225c0777271bb489ad6fb095aa10985ad138a81 (patch)
tree6f499bfc8972c43b1d90e218b8f239bdbc636432 /tools/testing/selftests/rcutorture/bin/cpus2use.sh
parent6dc82595ef0839a45c26075612f304979b6c92c2 (diff)
downloadlinux-7225c0777271bb489ad6fb095aa10985ad138a81.tar.xz
torture: Make --cpus override idleness calculations
Currently, rcutorture will use relatively few CPUs to build the kernel on a busy system, which is often as it should be. However, if the user has used the --cpus argument to dedicate a specified number of CPUs to this torture test, it would be good if the kernel build also made use of them. This commit therefore changes the cpus2use.sh script to use --cpus when specified and to do the idleness calculations otherwise. Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Diffstat (limited to 'tools/testing/selftests/rcutorture/bin/cpus2use.sh')
-rwxr-xr-xtools/testing/selftests/rcutorture/bin/cpus2use.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/cpus2use.sh b/tools/testing/selftests/rcutorture/bin/cpus2use.sh
index ff7102212703..4e9485590c10 100755
--- a/tools/testing/selftests/rcutorture/bin/cpus2use.sh
+++ b/tools/testing/selftests/rcutorture/bin/cpus2use.sh
@@ -9,6 +9,11 @@
#
# Authors: Paul E. McKenney <paulmck@linux.ibm.com>
+if test -n "$TORTURE_ALLOTED_CPUS"
+then
+ echo $TORTURE_ALLOTED_CPUS
+ exit 0
+fi
ncpus=`grep '^processor' /proc/cpuinfo | wc -l`
idlecpus=`mpstat | tail -1 | \
awk -v ncpus=$ncpus '{ print ncpus * ($7 + $NF) / 100 }'`