File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ set -eu -o pipefail
44shopt -s extglob
55
66declare -A core_ids
7+ declare -A disabled_cores
78
89# Learn all efficency cores if they exist
910cpu_list=()
@@ -13,6 +14,14 @@ if [ -f /sys/devices/cpu_atom/cpus ]; then
1314 cpu_list=($( eval echo {$start ..$end }) )
1415fi
1516
17+ disable_cpu () {
18+ cpu=" $1 "
19+ echo 0 > $cpu /online
20+ disabled_cores+=(" ${cpu##*/ } " )
21+ }
22+
23+ store_isolcpus_fact=" /var/tmp/isolcpus"
24+
1625# shellcheck disable=SC2012
1726for cpu in $( ls -1d /sys/devices/system/cpu/cpu* | sort --version-sort) ; do
1827 [[ $( basename $cpu ) =~ ^cpu[0-9]+$ ]] || continue
@@ -53,7 +62,7 @@ for cpu in $(ls -1d /sys/devices/system/cpu/cpu* | sort --version-sort) ; do
5362 found=0
5463 for efficiency_core in " ${cpu_list[@]} " ; do
5564 if [[ " $cpu " == " /sys/devices/system/cpu/cpu$efficiency_core " ]]; then
56- echo 0 > $cpu /online
65+ disable_cpu $cpu
5766 found=1
5867 break
5968 fi
@@ -63,7 +72,7 @@ for cpu in $(ls -1d /sys/devices/system/cpu/cpu* | sort --version-sort) ; do
6372 fi
6473
6574 if [[ ${core_ids[$core_id]:- } ]]; then
66- echo 0 > $cpu /online
75+ disable_cpu $cpu
6776 else
6877 core_ids[$core_id ]=1
6978 fi
@@ -94,3 +103,8 @@ elif [ -d $DIR_AMD ]; then
94103else
95104 echo " Warning: kernel (turbo) boost config not found in '$DIR_INTEL ' or '$DIR_AMD '."
96105fi
106+
107+ if [ -n " ${store_isolcpus_fact} " ]; then
108+ csv_string=$( IFS=, ; echo " ${disabled_cores[*]} " )
109+ echo " $csv_string " > " $store_isolcpus_fact "
110+ fi
You can’t perform that action at this time.
0 commit comments