Set the energy performance preference for AMD.
This commit is contained in:
parent
94b379c717
commit
c87ac216a9
21
ansible/roles/cpu/files/cpu_set_perf_perc_linux_amd
Normal file
21
ansible/roles/cpu/files/cpu_set_perf_perc_linux_amd
Normal file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Tell hardware p-states whether to maximize CPU performance (100) or
|
||||
# energy efficiency (0).
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
perc=$1
|
||||
|
||||
if [ "$perc" -ge 80 ]; then
|
||||
echo "performance" | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
|
||||
elif [ "$perc" -ge 60 ]; then
|
||||
echo "balance_performance" | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
|
||||
elif [ "$perc" -ge 40 ]; then
|
||||
echo "default" | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
|
||||
elif [ "$perc" -ge 20 ]; then
|
||||
echo "balance_power" | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
|
||||
else
|
||||
echo "power" | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
|
||||
fi
|
@ -3,3 +3,27 @@
|
||||
name:
|
||||
- powertop
|
||||
state: present
|
||||
|
||||
- name: Favor energy efficiency for Speed Shift
|
||||
when: hwpstate is defined and hwpstate and cores is defined
|
||||
template:
|
||||
src: "templates/{{ item.src }}.j2"
|
||||
dest: "{{ item.dest }}"
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: wheel
|
||||
loop:
|
||||
- src: energy_performance_preference.conf
|
||||
dest: /etc/tmpfiles.d/energy_performance_preference.conf
|
||||
|
||||
- name: Install scripts
|
||||
when: hwpstate is defined and hwpstate
|
||||
copy:
|
||||
src: "files/{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: wheel
|
||||
loop:
|
||||
- src: cpu_set_perf_perc_linux_amd
|
||||
dest: /usr/local/bin/cpu_set_perf_perc
|
||||
|
@ -35,5 +35,5 @@
|
||||
owner: root
|
||||
group: wheel
|
||||
loop:
|
||||
- src: cpu_set_perf_perc_linux
|
||||
- src: cpu_set_perf_perc_linux_intel
|
||||
dest: /usr/local/bin/cpu_set_perf_perc
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Favor energy efficiency for Speed Shift
|
||||
# Favor energy efficiency for hardware p-states
|
||||
{% for core in range(0, cores, 1) %}
|
||||
w- /sys/devices/system/cpu/cpufreq/policy{{core}}/energy_performance_preference - - - - power
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user