Skip to content

Commit b151f37

Browse files
authored
ubuntu hyperthreading changes
1 parent 87caac8 commit b151f37

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
if [ `id -u` -ne 0 ]
3+
then
4+
echo $0: you need to be root
5+
exit 1
6+
fi
7+
disable_ht() {
8+
echo -n $0: disabling
9+
echo off | sudo tee /sys/devices/system/cpu/smt/control
10+
}
11+
12+
enable_ht() {
13+
echo -n $0: enabling
14+
echo on | sudo tee /sys/devices/system/cpu/smt/control
15+
}
16+
17+
case "$1" in
18+
"1"|"on")
19+
enable_ht
20+
;;
21+
"0"|"off")
22+
disable_ht
23+
;;
24+
"show")
25+
;;
26+
*)
27+
echo $0: wrong argument "$1"
28+
exit 2
29+
;;
30+
esac
31+
32+
echo ''
33+
lscpu | egrep "On-line|Off-line"
34+
35+
exit 0
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Start this service to disable Hyperthreading, stop it to enable Hyperthreading.
3+
After=syslog.target irqbalance.service
4+
5+
[Service]
6+
Type=oneshot
7+
RemainAfterExit=true
8+
ExecStart=/opt/oci-hpc/sbin/control_hyperthreading_ubuntu.sh off
9+
ExecStop=/opt/oci-hpc/sbin/control_hyperthreading_ubuntu.sh on
10+
11+
[Install]
12+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)