Skip to content

Commit 9626353

Browse files
committed
Store disabled CPUs
We will use those later for a report and to not duplicate the method of disabling.
1 parent dc537ea commit 9626353

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

provision-contest/disable-turboboost_ht

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ set -eu -o pipefail
44
shopt -s extglob
55

66
declare -A core_ids
7+
declare -a disabled_cores
8+
9+
disable_cpu () {
10+
cpu="$1"
11+
echo 0 > $cpu/online
12+
disabled_cores+=("${cpu##*/}")
13+
}
714

815
# shellcheck disable=SC2012
916
for cpu in $(ls -1d /sys/devices/system/cpu/cpu* | sort --version-sort) ; do
@@ -41,7 +48,7 @@ for cpu in $(ls -1d /sys/devices/system/cpu/cpu* | sort --version-sort) ; do
4148
# 'delimiter'.
4249
core_id=$(cat $cpu/topology/core_id | tr -d '\n')'-'$(cat $cpu/topology/physical_package_id | tr -d '\n')
4350
if [[ ${core_ids[$core_id]:-} ]]; then
44-
echo 0 > $cpu/online
51+
disable_cpu $cpu
4552
else
4653
core_ids[$core_id]=1
4754
fi

0 commit comments

Comments
 (0)