File tree Expand file tree Collapse file tree 4 files changed +87
-0
lines changed
playbooks/roles/hyperthreading Expand file tree Collapse file tree 4 files changed +87
-0
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 11- include : el.yml
22 when : ansible_os_family == 'RedHat'
3+
4+ - include : ubuntu.yml
5+ when : ansible_distribution == 'Ubuntu'
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Make sure directory exist
3+ become : true
4+ file :
5+ path : /opt/oci-hpc/sbin
6+ state : directory
7+ mode : ' 0755'
8+
9+ - name : Copy script
10+ become : true
11+ copy :
12+ src : control_hyperthreading_ubuntu.sh
13+ dest : /opt/oci-hpc/sbin/control_hyperthreading_ubuntu.sh
14+ mode : ' 0755'
15+
16+ - name : Copy service unit
17+ become : true
18+ copy :
19+ src : disable-hyperthreading_ubuntu.service
20+ dest : /etc/systemd/system/disable-hyperthreading_ubuntu.service
21+
22+ - name : Create a unit file
23+ become : true
24+ copy :
25+ src : disable-hyperthreading_ubuntu.service
26+ dest : /etc/systemd/system/disable-hyperthreading.service
27+
28+ - name : Force systemd to reread configs
29+ ansible.builtin.systemd :
30+ daemon_reload : yes
31+
32+ - name :
33+ ansible.builtin.systemd :
34+ name : disable-hyperthreading_ubuntu.service
35+ state : started
36+ enabled : yes
37+ when : not hyperthreading|default(true)|bool
You can’t perform that action at this time.
0 commit comments