mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-08 21:34:25 +00:00
chore: better knowledge in the quest for power efficiency
This commit is contained in:
7
.vscode/settings.json
vendored
7
.vscode/settings.json
vendored
@@ -41,7 +41,9 @@
|
|||||||
"configmap",
|
"configmap",
|
||||||
"containerd",
|
"containerd",
|
||||||
"cowsay",
|
"cowsay",
|
||||||
|
"cpufreq",
|
||||||
"cpulimit",
|
"cpulimit",
|
||||||
|
"cpupower",
|
||||||
"cryptsetup",
|
"cryptsetup",
|
||||||
"csma",
|
"csma",
|
||||||
"datagram",
|
"datagram",
|
||||||
@@ -109,6 +111,7 @@
|
|||||||
"nvme",
|
"nvme",
|
||||||
"ocsp",
|
"ocsp",
|
||||||
"odhcpd",
|
"odhcpd",
|
||||||
|
"ondemand",
|
||||||
"openpgp",
|
"openpgp",
|
||||||
"opkg",
|
"opkg",
|
||||||
"pacman",
|
"pacman",
|
||||||
@@ -122,6 +125,8 @@
|
|||||||
"portsnap",
|
"portsnap",
|
||||||
"posix",
|
"posix",
|
||||||
"poweroff",
|
"poweroff",
|
||||||
|
"powersave",
|
||||||
|
"pstate",
|
||||||
"pulumi",
|
"pulumi",
|
||||||
"pvresize",
|
"pvresize",
|
||||||
"radeon",
|
"radeon",
|
||||||
@@ -136,6 +141,7 @@
|
|||||||
"runtimes",
|
"runtimes",
|
||||||
"sata",
|
"sata",
|
||||||
"schedulable",
|
"schedulable",
|
||||||
|
"schedutil",
|
||||||
"scrollback",
|
"scrollback",
|
||||||
"setfacl",
|
"setfacl",
|
||||||
"setfattr",
|
"setfattr",
|
||||||
@@ -168,7 +174,6 @@
|
|||||||
"xkcd",
|
"xkcd",
|
||||||
"zstd"
|
"zstd"
|
||||||
],
|
],
|
||||||
|
|
||||||
"markdown.extension.toc.levels": "2..6",
|
"markdown.extension.toc.levels": "2..6",
|
||||||
"markdown.extension.toc.orderedList": true
|
"markdown.extension.toc.orderedList": true
|
||||||
}
|
}
|
||||||
73
knowledge base/check or set the cpu frequency or governor.md
Normal file
73
knowledge base/check or set the cpu frequency or governor.md
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
# Check or set the CPU frequency or governor
|
||||||
|
|
||||||
|
1. [TL;DR](#tldr)
|
||||||
|
1. [Further readings](#further-readings)
|
||||||
|
1. [Sources](#sources)
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Check what governors are available.
|
||||||
|
cat '/sys/devices/system/cpu/cpufreq/'*'/scaling_available_governors'
|
||||||
|
|
||||||
|
# Get the current active governor.
|
||||||
|
cat '/sys/devices/system/cpu/cpufreq/policy0/scaling_governor'
|
||||||
|
cat '/sys/devices/system/cpu/cpufreq/'*'/scaling_governor'
|
||||||
|
|
||||||
|
# List the active CPUs affected by the current governor.
|
||||||
|
cat '/sys/devices/system/cpu/cpufreq/'*'/affected_cpus'
|
||||||
|
|
||||||
|
# Enable new governors.
|
||||||
|
echo 'schedutil' | sudo tee '/sys/devices/system/cpu/cpufreq/policy0/scaling_governor'
|
||||||
|
echo 'powersave' | sudo tee '/sys/devices/system/cpu/cpufreq/policy1/scaling_governor'
|
||||||
|
|
||||||
|
# Get the current frequency of CPUs.
|
||||||
|
cat '/sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq'
|
||||||
|
cat '/sys/devices/system/cpu/cpufreq/'*'/scaling_cur_freq'
|
||||||
|
|
||||||
|
# Do not boost the CPU frequency for niced loads.
|
||||||
|
# The governor must support it - check if the file exists.
|
||||||
|
echo 1 | sudo tee '/sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load'
|
||||||
|
|
||||||
|
# Disable (1) or enable (0) turbo boost for Intel CPUs.
|
||||||
|
echo 1 | sudo tee '/sys/devices/system/cpu/intel_pstate/no_turbo'
|
||||||
|
|
||||||
|
# Check what energy vs performance hint are available for CPUs.
|
||||||
|
cat '/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences'
|
||||||
|
|
||||||
|
# Get the current energy vs performance hint used by CPUs.
|
||||||
|
cat '/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference'
|
||||||
|
cat '/sys/devices/system/cpu/cpu'*'/cpufreq/energy_performance_preference'
|
||||||
|
|
||||||
|
# Set energy vs performance hints.
|
||||||
|
echo 'balance_performance' | sudo tee '/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference'
|
||||||
|
echo 'power' | sudo tee '/sys/devices/system/cpu/cpu'*'/cpufreq/energy_performance_preference'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Further readings
|
||||||
|
|
||||||
|
- [`cpupower`][cpupower]
|
||||||
|
- [Set the _ondemand_ CPU governor to not rise the frequencies for niced loads][set the ondemand cpu governor to not rise the frequencies for niced loads]
|
||||||
|
|
||||||
|
## Sources
|
||||||
|
|
||||||
|
All the references in the [further readings] section, plus the following:
|
||||||
|
|
||||||
|
- [CPU performance scaling]
|
||||||
|
- The [*intel_pstate* CPU performance scaling driver][intel_pstate cpu performance scaling driver]
|
||||||
|
|
||||||
|
<!--
|
||||||
|
References
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- In-article sections -->
|
||||||
|
[further readings]: #further-readings
|
||||||
|
|
||||||
|
<!-- Knowledge base -->
|
||||||
|
[cpupower]: cpupower.md
|
||||||
|
[set the ondemand cpu governor to not rise the frequencies for niced loads]: set%20the%20ondemand%20cpu%20governor%20to%20not%20rise%20the%20frequencies%20for%20niced%20loads.md
|
||||||
|
[tlp]: tlp.md
|
||||||
|
|
||||||
|
<!-- Upstream -->
|
||||||
|
[cpu performance scaling]: https://www.kernel.org/doc/html/latest/admin-guide/pm/cpufreq.html
|
||||||
|
[intel_pstate cpu performance scaling driver]: https://www.kernel.org/doc/html/next/admin-guide/pm/intel_pstate.html
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
# Check or set the CPU frequency or governor
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cat '/sys/devices/system/cpu/cpufreq/'*'/affected_cpus'
|
|
||||||
cat '/sys/devices/system/cpu/cpufreq/'*'/scaling_available_governors'
|
|
||||||
|
|
||||||
# Get the current active governor.
|
|
||||||
cat '/sys/devices/system/cpu/cpufreq/policy0/scaling_governor'
|
|
||||||
cat '/sys/devices/system/cpu/cpufreq/'*'/scaling_governor'
|
|
||||||
|
|
||||||
# Enable a new governor.
|
|
||||||
echo 'schedutil' | sudo tee '/sys/devices/system/cpu/cpufreq/policy0/scaling_governor'
|
|
||||||
echo 'powersave' | sudo tee '/sys/devices/system/cpu/cpufreq/policy1/scaling_governor'
|
|
||||||
|
|
||||||
# Do not boost the CPU frequency for nice loads.
|
|
||||||
echo 1 | sudo tee '/sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load'
|
|
||||||
```
|
|
||||||
@@ -6,19 +6,29 @@ Default governor is _ondemand_ for older CPUs and kernels and _schedutil_ for ne
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Install.
|
# Install.
|
||||||
sudo apt install 'linux-cpupower'
|
apt install 'linux-cpupower'
|
||||||
sudo dnf install 'kernel-tools'
|
dnf install 'kernel-tools'
|
||||||
|
zypper install 'cpupower'
|
||||||
|
|
||||||
# List the available governors.
|
# List the available governors.
|
||||||
cpupower frequency-info --governors
|
cpupower frequency-info --governors
|
||||||
|
cpupower -c "3-6" frequency-info --governors
|
||||||
|
cpupower --cpu "0-$(( $(nproc) - 1 ))" frequency-info --governors
|
||||||
|
|
||||||
# Get the current active governor.
|
# Get the current active governor.
|
||||||
cpupower frequency-info --policy
|
cpupower frequency-info --policy
|
||||||
|
cpupower -c '4' frequency-info --policy
|
||||||
|
cpupower --cpu '4,5' frequency-info --policy
|
||||||
|
|
||||||
# Set a new governor until reboot.
|
# Set new governors until reboot.
|
||||||
sudo cpupower frequency-set -g 'performance'
|
sudo cpupower frequency-set -g 'performance'
|
||||||
sudo cpupower frequency-set --governor 'powersave'
|
sudo cpupower -c '1' frequency-set --governor 'powersave'
|
||||||
sudo cpupower frequency-set --governor 'schedutil'
|
sudo cpupower --cpu '2,4,7' frequency-set --governor 'schedutil'
|
||||||
|
|
||||||
|
# Get the current frequency of CPUs.
|
||||||
|
cpupower frequency-info -f
|
||||||
|
cpupower -c '4-7' frequency-info -fm
|
||||||
|
cpupower --cpu '2,5' frequency-info --freq --human
|
||||||
```
|
```
|
||||||
|
|
||||||
## Further readings
|
## Further readings
|
||||||
|
|||||||
@@ -8,16 +8,16 @@
|
|||||||
## TL;DR
|
## TL;DR
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo cpupower frequency-set --governor ondemand
|
sudo cpupower frequency-set --governor 'ondemand'
|
||||||
echo 1 | sudo tee /sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load
|
echo 1 | sudo tee '/sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load'
|
||||||
|
|
||||||
# set this on boot
|
# set this on boot
|
||||||
echo "w /sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load - - - - 1" | sudo tee /etc/tmpfiles.d/ondemand-ignore-nice.conf
|
echo "w /sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load - - - - 1" | sudo tee '/etc/tmpfiles.d/ondemand-ignore-nice.conf'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Further readings
|
## Further readings
|
||||||
|
|
||||||
- [Cpufreq]
|
- [`cpupower`][cpupower]
|
||||||
- [Laptop overheating and battery duration reduction]
|
- [Laptop overheating and battery duration reduction]
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
88
knowledge base/tlp.md
Normal file
88
knowledge base/tlp.md
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
# tlp
|
||||||
|
|
||||||
|
1. [TL;DR](#tldr)
|
||||||
|
1. [Further readings](#further-readings)
|
||||||
|
1. [Sources](#sources)
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
Manual mode: changes to the power source will be ignored until the next reboot, or until the `tlp start` command is issued to resume automatic mode.
|
||||||
|
|
||||||
|
Changes through commands are valid until next reboot.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Install it.
|
||||||
|
zypper install 'tlp' 'tlp-rdw'
|
||||||
|
|
||||||
|
# Start the service.
|
||||||
|
sudo tlp start
|
||||||
|
sudo systemctl start 'tlp.service'
|
||||||
|
|
||||||
|
# Show information about the system.
|
||||||
|
sudo tlp-stat
|
||||||
|
|
||||||
|
# Show information about the CPU only.
|
||||||
|
# Includes the active scaling driver and available governors.
|
||||||
|
sudo tlp-stat -p
|
||||||
|
sudo tlp-stat --processor -v
|
||||||
|
|
||||||
|
# Show information about the battery only.
|
||||||
|
sudo tlp-stat -b
|
||||||
|
sudo tlp-stat --battery
|
||||||
|
|
||||||
|
# Show the service's status.
|
||||||
|
tlp-stat -s
|
||||||
|
tlp-stat --system
|
||||||
|
|
||||||
|
# Show the active configuration.
|
||||||
|
tlp-stat -c
|
||||||
|
tlp-stat --config
|
||||||
|
|
||||||
|
# Show differences between the defaults and the user configuration.
|
||||||
|
# From version 1.4.
|
||||||
|
tlp-stat --cdiff
|
||||||
|
|
||||||
|
# Apply profiles.
|
||||||
|
# Doing this enters manual mode.
|
||||||
|
sudo tlp bat
|
||||||
|
sudo tlp ac
|
||||||
|
|
||||||
|
# Change battery charge thresholds.
|
||||||
|
sudo tlp setcharge '70' '90' 'BAT0'
|
||||||
|
|
||||||
|
# Restore battery charge thresholds.
|
||||||
|
sudo tlp setcharge
|
||||||
|
|
||||||
|
# Check, enable, or disable automatic, event based actions on radio devices.
|
||||||
|
# Leverages the Radio Device Wizard.
|
||||||
|
tlp-rdw
|
||||||
|
tlp-rdw enable
|
||||||
|
tlp-rdw disable
|
||||||
|
```
|
||||||
|
|
||||||
|
## Further readings
|
||||||
|
|
||||||
|
- [Documentation]
|
||||||
|
- [`cpupower`][cpupower]
|
||||||
|
|
||||||
|
## Sources
|
||||||
|
|
||||||
|
All the references in the [further readings] section, plus the following:
|
||||||
|
|
||||||
|
- [Battery care vendor specifics]
|
||||||
|
|
||||||
|
<!--
|
||||||
|
References
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- In-article sections -->
|
||||||
|
[further readings]: #further-readings
|
||||||
|
|
||||||
|
<!-- Knowledge base -->
|
||||||
|
[cpupower]: cpupower.md
|
||||||
|
|
||||||
|
<!-- Upstream -->
|
||||||
|
[battery care vendor specifics]: https://linrunner.de/tlp/settings/bc-vendors.html
|
||||||
|
[documentation]: https://linrunner.de/tlp/index.html
|
||||||
|
|
||||||
|
<!-- Others -->
|
||||||
Reference in New Issue
Block a user