CPU governor (by quqi99)

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明 (作者:张华 发表于:2019-04-25)

performance and powersave

# we can set CPU governor in BIOS or Power Mangement Program or the following Linux commands
sudo apt install cpufrequtils sysfsutils linux-tools-generic linux-tools-$(uname -r) linux-cloud-tools-$(uname -r) -y
# all cpu info
cpufreq-info
# cpu info for just cpu0
cpupower frequency-info
# just set cpu0 to performance mode
sudo cpufreq-set -g performance
# set all cpu to powersave mode
sudo cpupower -c all frequency-set -g powersave
sudo cpupower -c 0 frequency-set -g performance
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
cat /proc/cpuinfo | grep -i "cpu mhz"

# How to persistence these configurations
sudo sed -i 's/^GOVERNOR=.*/GOVERNOR="powersave"/'/etc/init.d/cpufrequtils
# or
echo 'GOVERNOR="powersave"' | sudo tee/etc/default/cpufrequtils

sudo systemctl restart cpufrequtils
sudo systemctl disable ondemand

userspace and ondemand

This is because your system is using the new driver called intel_pstate. There are only two governors available when using this driver: powersave and performance.
The userspace governor is only available with the older acpi-cpufreq driver (which will be automatically used if you disable intel_pstate at boot time; you then set the governor/frequency with cpupower):

disable the current driver: add intel_pstate=disable to your kernel boot line
boot, then load the userspace module: modprobe cpufreq_userspace
set the governor: cpupower frequency-set --governor userspace
set the frequency: cpupower --cpu all frequency-set --freq 800MHz
NOTE: 还是要intel-pstate驱动吧,因为:

  • intel_pstate驱动程序知道CPU工作方式的详细信息,并且比通用ACPI解决方案做得更好
  • intel_pstate仅提供两个调控器,powersave而performance。英特尔声称intel_pstate的“省电”速度比具有“性能”的通用acpi调速器快

openwrt setting

for core in $(seq 0 "$(($(getconf _NPROCESSORS_ONLN) - 1))"); do
echo {performance|powersave} >/sys/devices/system/cpu/cpu$core/cpufreq/scaling_governor ;
done

Reference

[1] https://segmentfault.com/a/1190000012772062

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

quqi99

你的鼓励就是我创造的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值