Skip to content

Commit b7e1e65

Browse files
committed
Disable efficiency cores
Also clarified the package/socket as package is more correct but socket is better known and fixed a typo.
1 parent e9e2581 commit b7e1e65

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

provision-contest/disable-turboboost_ht

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ disable_cpu () {
1414

1515
store_isolcpus_fact="/var/tmp/isolcpus"
1616

17+
# Learn all efficency cores if they exist
18+
cpu_list=()
19+
if [ -f /sys/devices/cpu_atom/cpus ]; then
20+
range="$(cat /sys/devices/cpu_atom/cpus)"
21+
IFS='-' read -r start end <<< "$range"
22+
cpu_list=($(eval echo {$start..$end}))
23+
fi
24+
1725
# shellcheck disable=SC2012
1826
for cpu in $(ls -1d /sys/devices/system/cpu/cpu* | sort --version-sort) ; do
1927
[[ $(basename $cpu) =~ ^cpu[0-9]+$ ]] || continue
@@ -49,6 +57,20 @@ for cpu in $(ls -1d /sys/devices/system/cpu/cpu* | sort --version-sort) ; do
4957
# adds a newline after each file, we do not want to rely on `cat` to always add this
5058
# 'delimiter'.
5159
core_id=$(cat $cpu/topology/core_id | tr -d '\n')'-'$(cat $cpu/topology/physical_package_id | tr -d '\n')
60+
61+
# Disable all efficiency cores
62+
found=0
63+
for efficiency_core in "${cpu_list[@]}"; do
64+
if [[ "$cpu" == "/sys/devices/system/cpu/cpu$efficiency_core" ]]; then
65+
disable_cpu $cpu
66+
found=1
67+
break
68+
fi
69+
done
70+
if [ "$found" -eq "1" ]; then
71+
continue
72+
fi
73+
5274
if [[ ${core_ids[$core_id]:-} ]]; then
5375
disable_cpu $cpu
5476
else

0 commit comments

Comments
 (0)