configNR_CPUS.sh 688 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. # SPDX-License-Identifier: GPL-2.0+
  3. #
  4. # Extract the number of CPUs expected from the specified Kconfig-file
  5. # fragment by checking CONFIG_SMP and CONFIG_NR_CPUS. If the specified
  6. # file gives no clue, base the number on the number of idle CPUs on
  7. # the system.
  8. #
  9. # Usage: configNR_CPUS.sh config-frag
  10. #
  11. # Copyright (C) IBM Corporation, 2013
  12. #
  13. # Authors: Paul E. McKenney <paulmck@linux.ibm.com>
  14. cf=$1
  15. if test ! -r $cf
  16. then
  17. echo Unreadable config fragment $cf 1>&2
  18. exit -1
  19. fi
  20. if grep -q '^CONFIG_SMP=n$' $cf
  21. then
  22. echo 1
  23. exit 0
  24. fi
  25. if grep -q '^CONFIG_NR_CPUS=' $cf
  26. then
  27. grep '^CONFIG_NR_CPUS=' $cf |
  28. sed -e 's/^CONFIG_NR_CPUS=\([0-9]*\).*$/\1/'
  29. exit 0
  30. fi
  31. cpus2use.sh