Skip to content

Commit

Permalink
Sort CPUs/cores in disable turboboost script numerically.
Browse files Browse the repository at this point in the history
This results in a slightly easier to understand outcome.

On CPUs like where there are 8+8 cores with hyperthreading and cpu0 is on the same core as cpu9, cpu1 and cpu10 etc.
Since the script went through cpus lexicographically, it did traverse cpu 10-15 before doing 2-9. This resulted in disabling cpus 2-9, while cpu0, cpu1 and cpu 10-15 were online which is very confusing.

Now it sorts things numerically, so goes through them in a more predictable order and the results is more predictable: in this particular case, cpu 0-7 are online, and cpu 8-15 are disabled.
In more general words: the cpu with the lowest number of each core is still online, higher numbers are disabled.
  • Loading branch information
meisterT committed Sep 3, 2023
1 parent 4edfdff commit cf046c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion provision-contest/disable-turboboost_ht
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ shopt -s extglob

declare -A core_ids

for cpu in /sys/devices/system/cpu/cpu* ; do
for cpu in $(ls -1d /sys/devices/system/cpu/cpu* | sort --version-sort) ; do
[[ $(basename $cpu) =~ ^cpu[0-9]+$ ]] || continue

# Reenable stuff in case we are rerunning this script.
Expand Down

0 comments on commit cf046c1

Please sign in to comment.