Skip to main content

Linux Cpufrequtils CPU頻率控制

使用cpufrequtils可降頻來降低溫度和省電

確認CPU驅動

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver

如果顯示為 intel_pstate,您可能需要禁用它並切換到 intel-cpufreq 驅動程序

編輯/etc/default/grub,在GRUB_CMDLINE_LINUX_DEFAULT加入intel_pstate=disable

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_pstate=disable"

update-grub
reboot

再次確認狀態為intel-cpufre

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver

安裝Cpufrequtils

apt-get install cpufrequtils

查看支持cpu管理模式

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
conservative ondemand userspace powersave performance schedutil

查看CPU訊息

cpufreq-info

 

root@pve:~# cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: intel_cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 20.0 us.
  hardware limits: 1.20 GHz - 3.50 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 1.20 GHz and 3.50 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 3.05 GHz.

修改模式

編輯/etc/init.d/cpufrequtils

ENABLE="true"
GOVERNOR="powersave"     <<<修改模式 ondemand改powersave
MAX_SPEED="0"
MIN_SPEED="0"

 

systemctl daemon-reload
/etc/init.d/cpufrequtils restart
root@pve:~# cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: intel_cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 20.0 us.
  hardware limits: 1.20 GHz - 3.50 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 1.20 GHz and 3.50 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 1.20 GHz.