我有一台带有 Xubuntu 18.04 LTS 的联想 T570。我目前的问题是我的 cpu 速度步进有点发疯,并且做了它认为最好的事情。
示例:当我运行我的 IDE 并且在构建期间 CPU 负载增加时,调控器会自动更改。我在编译我的项目期间通过以下调用抓住了这一刻:
martin@martin-ThinkPad-T570:~$ while cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor; do sleep 1; done
powersave
powersave
performance
performance
cpufreq-info 告诉我这个:
martin@martin-ThinkPad-T570:~$ cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to [email protected], please.
analyzing CPU 0:
driver: intel_pstate
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 4294.55 ms.
hardware limits: 400 MHz - 3.50 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 3.50 GHz and 3.50 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 3.25 GHz.
analyzing CPU 1:
driver: intel_pstate
CPUs which run at the same hardware frequency: 1
CPUs which need to have their frequency coordinated by software: 1
maximum transition latency: 4294.55 ms.
hardware limits: 400 MHz - 3.50 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 3.50 GHz and 3.50 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 3.36 GHz.
analyzing CPU 2:
driver: intel_pstate
CPUs which run at the same hardware frequency: 2
CPUs which need to have their frequency coordinated by software: 2
maximum transition latency: 4294.55 ms.
hardware limits: 400 MHz - 3.50 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 3.50 GHz and 3.50 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 3.26 GHz.
analyzing CPU 3:
driver: intel_pstate
CPUs which run at the same hardware frequency: 3
CPUs which need to have their frequency coordinated by software: 3
maximum transition latency: 4294.55 ms.
hardware limits: 400 MHz - 3.50 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 3.50 GHz and 3.50 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 3.36 GHz.
请看一下
当前政策:频率应在 3.50 GHz 和 3.50 GHz 之间。调速器“性能”可以决定使用哪种速度
之后回到 powersave 我使用我的小脚本:
martin@martin-ThinkPad-T570:~$ cat cpu_freq_save.sh
#!/bin/bash
sudo cpufreq-set -g powersave -c 0 --min 400MHz
sudo cpufreq-set -g powersave -c 1 --min 400MHz
sudo cpufreq-set -g powersave -c 2 --min 400MHz
sudo cpufreq-set -g powersave -c 3 --min 400MHz
这会重置最小频率和调速器,但只要我每次使用我的 IDE 再次编译调速器和最小频率再次更改时。
知道如何禁用该自动更改吗?
PS:如果您需要更多详细信息,请告诉我在哪里可以找到它们,我会提供
我玩了很多不同的东西,最终
cpufreqd
从我的系统中删除,只留下cpufrequtils
安装和繁荣,它不再在负载时切换调速器。以下内容还将删除您的配置文件,因此如果您计划将来
cpufreqd
可能重新安装,请备份它们。cpufreqd
改变应该是立竿见影的。将调速器设置为省电后,使用:
重载后,调速器将不再切换到性能。
cpufreqd
是一个频率管理守护进程,安装有:配置文件cpufreqd.conf用于更改频率。有两个部分您可以看到它将调控器更改为“性能”:
除非拔掉电池充电器,否则很难弄清楚它何时变为“省电”。
由于内核 3.4 cpufreq内置于内核并自动加载。它包括频率管理守护进程,称为
thermald
. 因此,不再需要太多cpufreqd
了,它可能在您的系统上发生了冲突。为了在电池供电下进行更大程度的定制,如今
tlp
通常使用该包装。如果您打算禁用 intel_pstate 驱动程序,您可以在启动时使用内核 arg 执行此操作
intel_pstate=disable
这可能不符合您的最佳利益,因为 intel_pstate 驱动程序了解 CPU 工作方式的详细信息,并且它比通用 ACPI 解决方案做得更好。英特尔声称 intel_pstate “powersave”比具有“性能”的通用 acpi 调控器更快,这可能是因为执行某些具有更高频率的任务将消耗更少的功率,而不是需要更多时间的较低频率,例如算术东西,但并非对所有任务都是如此例如从内存中加载一些东西。
你能做的最好的事情就是忽略它,让 intel_pstate 驱动程序完成它的工作,允许使用内置在芯片中的TurboBoost 技术,它会根据额定功率、额定温度和电流限制自动调整频率
对于当代英特尔处理器,例如您似乎拥有的Core i5 7300U(尽管您没有提及型号),频率由处理器本身控制,并且暴露于软件的 P 状态与性能水平有关。频率可以设置为单一频率的想法是英特尔酷睿处理器的虚构。即使缩放驱动程序选择单个 P 状态,处理器运行的实际频率也是由处理器本身选择的。
资料来源:
https://unix.stackexchange.com/questions/121410/setting-cpu-governor-to-on-demand-or-conservative
https://www.cnet.com/products/lenovo-thinkpad-t570-15-6-core-i5-7300u-8-gb-ram-256-gb-ssd-20h9000uus/
https://en.wikichip.org/wiki/intel/core_i5/i5-7300u