33 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.0+3#4# Extract the number of CPUs expected from the specified Kconfig-file5# fragment by checking CONFIG_SMP and CONFIG_NR_CPUS. If the specified6# file gives no clue, base the number on the number of idle CPUs on7# the system.8#9# Usage: configNR_CPUS.sh config-frag10#11# Copyright (C) IBM Corporation, 201312#13# Authors: Paul E. McKenney <paulmck@linux.ibm.com>14 15cf=$116if test ! -r $cf17then18 echo Unreadable config fragment $cf 1>&219 exit -120fi21if grep -q '^CONFIG_SMP=n$' $cf22then23 echo 124 exit 025fi26if grep -q '^CONFIG_NR_CPUS=' $cf27then28 grep '^CONFIG_NR_CPUS=' $cf | 29 sed -e 's/^CONFIG_NR_CPUS=\([0-9]*\).*$/\1/'30 exit 031fi32cpus2use.sh33