Ubuntu 16.04桌面性能 – 将CPU频率调节器设置为性能

编辑:添加PC规格以防万一。

i7-5820k x99P-SLI 32GB DDR4 GTX 970 

我在16.04的全新安装中遇到了低于标准的性能,经过一些研究,了解了cpupower和CPU频率调节器。 默认情况下,我的CPU驱动程序是intel_ptstate而我的频率powersave器是powersave 。 我手动将调速器设置为performance后,我的机器运行速度明显加快,因为它使我的CPU在3.30 Ghz和1.20 Ghz之间运行。

我还通过禁用Grub中的intel_pstate驱动程序来测试旧的acpi-cpufreq驱动程序。 它现在使用ondemand器,但性能基本相同:差。

这是cpupower frequency-info的输出

 tommy@desktop:~$ cpupower frequency-info analyzing CPU 0: driver: acpi-cpufreq CPUs which run at the same hardware frequency: 0 CPUs which need to have their frequency coordinated by software: 0 maximum transition latency: 10.0 us. hardware limits: 1.20 GHz - 3.30 GHz available frequency steps: 3.30 GHz, 3.30 GHz, 3.10 GHz, 3.00 GHz, 2.80 GHz, 2.70 GHz, 2.50 GHz, 2.40 GHz, 2.20 GHz, 2.10 GHz, 1.90 GHz, 1.80 GHz, 1.60 GHz, 1.50 GHz, 1.30 GHz, 1.20 GHz available cpufreq governors: conservative, ondemand, userspace, powersave, performance current policy: frequency should be within 1.20 GHz and 3.30 GHz. The governor "ondemand" may decide which speed to use within this range. current CPU frequency is 1.20 GHz. cpufreq stats: 3.30 GHz:3.98%, 3.30 GHz:0.00%, 3.10 GHz:0.26%, 3.00 GHz:0.17%, 2.80 GHz:0.31%, 2.70 GHz:0.23%, 2.50 GHz:0.29%, 2.40 GHz:0.41%, 2.20 GHz:0.52%, 2.10 GHz:0.59%, 1.90 GHz:0.99%, 1.80 GHz:1.52%, 1.60 GHz:2.68%, 1.50 GHz:5.51%, 1.30 GHz:16.70%, 1.20 GHz:65.84% (14777) boost state support: Supported: yes Active: yes 

两个三个问题:

  • 我应该像这样改变州长吗?
  • 一些进一步的研究表明,您不应该使用intel_pstate驱动程序强制执行。 这是真的?
  • 如果没问题,我该如何将调速器永久设置为性能? 我尝试制作一个系统服务,将其设置为启动,但我不确定它是否正常工作。 它将调控器设置为启动时的性能,然后在几分钟后将其更改为powersave。 这是在使用intel_pstate驱动程序时。

这是我创建的服务cpupower.service的内容。

 tommy@desktop:~$ cat /etc/systemd/system/cpupower.service [Unit] Description=CPU performance [Service] Type=oneshot ExecStart=/usr/bin/cpupower -c all frequency-set -g performance [Install] WantedBy=multi-user.target 

我希望这有道理! 如果有人能提供一些帮助,并帮助我了解正在发生的事情的大局,我将非常感激。

谢谢。

你有3个问题:

我应该像这样改变州长吗?

当然,如果这是你想要做的。 成本是更高的能源消耗。 请注意,即使使用performance调控器,CPU本身也可以在非常低的负载下退避pstate(性能状态)。

 Some further research said that you shouldn't force performance with the intel_pstate driver. Is this true? 

人们不应该注意到使用intel_pstate CPU频率驱动程序的powersaveperformance CPU频率调节器之间存在很大差异。 然而,显然,你似乎有一些独特的工作流程,突出了差异。 回答你的问题:你可以做任何你想做的事情以及对你的应用有意义的事情。

如果没问题,我该如何将调速器永久设置为性能? 我尝试制作一个系统服务,将其设置为启动,但我不确定它是否正常工作。 它将调控器设置为启动时的性能,然后在几分钟后将其更改为powersave。 这是在使用intel_pstate驱动程序时。

Ubuntu使用脚本/etc/init.d/ondemand ,在1分钟后将ondemand更改为ondemand (或者如果没有ondemand则为powersave )。 因此,在更改调控器之前,您必须删除或修改它,或添加一些睡眠时间超过1分钟的其他启动脚本。

由Ubuntu内核配置文件定义的缺省值是引导期间的performance调控器。