Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rcutorture: Handle different mpstat versions

The mpstat command recently added the %gnice column, which messes up
the cpu2use.sh script's idle-CPU calculations. This commit therefore
uses $NF instead of $12 to select the last (%idle) column.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

+1 -1
+1 -1
tools/testing/selftests/rcutorture/bin/cpus2use.sh
··· 24 24 25 25 ncpus=`grep '^processor' /proc/cpuinfo | wc -l` 26 26 idlecpus=`mpstat | tail -1 | \ 27 - awk -v ncpus=$ncpus '{ print ncpus * ($7 + $12) / 100 }'` 27 + awk -v ncpus=$ncpus '{ print ncpus * ($7 + $NF) / 100 }'` 28 28 awk -v ncpus=$ncpus -v idlecpus=$idlecpus < /dev/null ' 29 29 BEGIN { 30 30 cpus2use = idlecpus;