torture: Make --cpus override idleness calculations
authorPaul E. McKenney <paulmck@linux.ibm.com>
Sun, 12 May 2019 00:59:52 +0000 (17:59 -0700)
committerPaul E. McKenney <paulmck@linux.ibm.com>
Tue, 28 May 2019 16:06:09 +0000 (09:06 -0700)
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>
tools/testing/selftests/rcutorture/bin/cpus2use.sh
tools/testing/selftests/rcutorture/bin/kvm.sh

index ff7102212703167dc38b84f667425e9e2b19655d..4e9485590c10d5535a08ebf030518fcecb2e7be9 100755 (executable)
@@ -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 }'`
index 8c43eb43409b285d9c457807792a1cb2c9d2092a..ea6289a335f2223feb793c382b6d930e02db59a6 100755 (executable)
@@ -24,6 +24,7 @@ dur=$((30*60))
 dryrun=""
 KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
 PATH=${KVM}/bin:$PATH; export PATH
+TORTURE_ALLOTED_CPUS=""
 TORTURE_DEFCONFIG=defconfig
 TORTURE_BOOT_IMAGE=""
 TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD
@@ -89,6 +90,7 @@ do
        --cpus)
                checkarg --cpus "(number)" "$#" "$2" '^[0-9]*$' '^--'
                cpus=$2
+               TORTURE_ALLOTED_CPUS="$2"
                shift
                ;;
        --datestamp)
@@ -285,6 +287,7 @@ cat << ___EOF___ > $T/script
 CONFIGFRAG="$CONFIGFRAG"; export CONFIGFRAG
 KVM="$KVM"; export KVM
 PATH="$PATH"; export PATH
+TORTURE_ALLOTED_CPUS="$TORTURE_ALLOTED_CPUS"; export TORTURE_ALLOTED_CPUS
 TORTURE_BOOT_IMAGE="$TORTURE_BOOT_IMAGE"; export TORTURE_BOOT_IMAGE
 TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY
 TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG