summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/rcutorture/bin/cpus2use.sh
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2020-01-25 10:05:23 +0100
committerIngo Molnar <mingo@kernel.org>2020-01-25 10:05:23 +0100
commitf8a4bb6bfa639fbdd07aede615be6dffe86a9713 (patch)
tree158a3e44edfd02bb81addfb779ea1850114f3361 /tools/testing/selftests/rcutorture/bin/cpus2use.sh
parent4703d9119972bf586d2cca76ec6438f819ffa30e (diff)
parent0e247386d9ed5ab8b7dad010cf4b183efeb1e47d (diff)
Merge branch 'for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu into core/rcu
Pull RCU updates from Paul E. McKenney: - Expedited grace-period updates - kfree_rcu() updates - RCU list updates - Preemptible RCU updates - Torture-test updates - Miscellaneous fixes - Documentation updates Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/testing/selftests/rcutorture/bin/cpus2use.sh')
-rwxr-xr-xtools/testing/selftests/rcutorture/bin/cpus2use.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/cpus2use.sh b/tools/testing/selftests/rcutorture/bin/cpus2use.sh
index 4e9485590c10..1dbfb62567d2 100755
--- a/tools/testing/selftests/rcutorture/bin/cpus2use.sh
+++ b/tools/testing/selftests/rcutorture/bin/cpus2use.sh
@@ -15,8 +15,15 @@ then
exit 0
fi
ncpus=`grep '^processor' /proc/cpuinfo | wc -l`
-idlecpus=`mpstat | tail -1 | \
- awk -v ncpus=$ncpus '{ print ncpus * ($7 + $NF) / 100 }'`
+if mpstat -V > /dev/null 2>&1
+then
+ idlecpus=`mpstat | tail -1 | \
+ awk -v ncpus=$ncpus '{ print ncpus * ($7 + $NF) / 100 }'`
+else
+ # No mpstat command, so use all available CPUs.
+ echo The mpstat command is not available, so greedily using all CPUs.
+ idlecpus=$ncpus
+fi
awk -v ncpus=$ncpus -v idlecpus=$idlecpus < /dev/null '
BEGIN {
cpus2use = idlecpus;