ubuntu上disable intel_pstate,使用固定频率

从Ubuntu15的某个版本开始,在使用intel某些cpu的pc上认使用intel_pstatecpufreq driver。后果就是只有performance和powersave两个governor可用。可通过下面命令确认:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governor

powersave performance

或者用 cpufreq-info

$ cpufreq-info

cpufrequtils 008: cpufreq-info (C) Dominikbrodowski 2004-2009

Report errors and bugs tocpufreq@vger.kernel.org,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: 0.97 ms.

hardware limits: 1.20 GHz - 2.80 GHz

available cpufreq governors: performance,powersave

current policy: frequency should be within 1.20 GHz and 2.80 GHz.

The governor"powersave" may decide which speed to use

within this range.

current cpu frequency is 1.21 GHz.

注: 要使用cpufreq-info和后面要提到的cpufreq-set,请先安装cpufrequtils,后面会提到。

在使用intel_pstate cpufreq driver的情况下,即使governor是powersave或者performance,但观测发现scaling_cur_freq是一直变化的,而不是像它们的含义一样,使用最低或者最高频率。

如果要测试系统或者软件的性能,我们需要固定cpu频率。本文讲述如何在这种的pc上固定cpu频率。

1. 安装cpufrequtils

sudo apt-get install cpufrequtils

2. disableintel_pstate driver

in /etc/default/grub,change

GRUB_CMDLINE_LINUX_DEFAULT="quietsplash"

to

GRUB_CMDLINE_LINUX_DEFAULT="quietsplash intel_pstate=disable"

sudo update-grub

after reboot,then acpi-cpufreq driver willbe used.

3. 固定频率

这时sysfs下cpufreq相关的节点就是我们熟悉的文件了。

可使用powersave来使用固定的最低频率,

sudo cpufreq-set -g performance

也可使用performance governor来使用固定的最高频率

sudo cpufreq-set -g powersave

推荐使用userspace governor,然后设置我们期望的频率(这里假设我们要设置cpu频率为2GHz).

sudo cpufreq-set -g userspace

sudo cpufreq-set -f 2000000

相关文章

目录前言一、创建Hadoop用户二、更新apt和安装Vim编辑器三、...
原文连接:https://www.cnblogs.com/yasmi/p/5192694.html ...
电脑重启后,打开VirtualBox,发现一直用的虚拟机莫名的消失...
参见:https://blog.csdn.net/weixin_38883338/article/deta...
Ubuntu 18.04 LTS 已切换到 Netplan 来配置网络接口。Netpla...
介绍每个 Web 服务都可以通过特定的 URL 在 Internet 上访问...