Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort CPUs/cores in disable turboboost script numerically. #95

Merged
merged 4 commits into from
Sep 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following command should give the same output (verified locally) and should make shellcheck happy:
find /sys/devices/system/cpu -maxdepth 1 -mindepth 1 -name 'cpu*' | sort --version-sort.

The max- and mindepth flags are needed to ensure it only lists the cpu's and skips the directory itself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is shellcheck unhappy about? I'm fine with suppressing an issue that is unlikely to cause harm.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./provision-contest/disable-turboboost_ht:8:14: note: Use find instead of ls to better handle non-alphanumeric filenames. [SC2012]

use find instead of ls

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pfff, that's just random advice that doesn't apply here inside /sys/.... Let's suppress.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eldering so this can be merged as is?

[[ $(basename $cpu) =~ ^cpu[0-9]+$ ]] || continue

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