Ubuntu – Ubuntu 16.04 Desktop performance – setting CPU frequency governor to performance

16.04

Edit: Adding PC specs in case it helps.

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

I've been experiencing sub-par performance on a fresh install of 16.04 and after some research, learned about cpupower and CPU frequency governors. By default my CPU driver is intel_ptstate and my frequency governor is powersave. My machine performed noticeably faster after I manually set the governor to performance as it keeps my CPU operating around 3.30 Ghz vs 1.20 Ghz.

I also tested the older acpi-cpufreq driver by disabling the intel_pstate driver in Grub. It is now using the ondemand governor, but performance is basically the same: poor.

Here is the output of 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

Two Three questions:

  • Should I be changing the governors like this?
  • Some further research said that you shouldn't force performance with the intel_pstate driver. Is this true?
  • If it's ok, how do I permanently set the governor to performance? I tried making a systemd service that set it at boot, but I'm not sure if it's working. It sets the governor to performance at boot, then changes it to powersave after a few minutes. This is when using the intel_pstate driver.

Here is the contents of the service cpupower.service that I created.

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

I hope this kind of makes sense! If anyone can provide some help, and help me understand the bigger picture of what's going on, I'd be extremely grateful.

Thanks.

Best Answer

You had 3 questions:

Should I be changing the governors like this?

Sure, if that is what you want to do. The cost is higher energy consumption. Note that even using the performance governor the CPU itself can backoff the pstate (performance state) under very low load.

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

One shouldn't notice a great lot of difference between the powersave and performance CPU frequency governors using the intel_pstate CPU frequency driver. However, and apparently, you seems to have some sort of unique work flow that accentuates the difference. To answer your question: You can do whatever you want and whatever makes sense for your application.

If it's ok, how do I permanently set the governor to performance? I tried making a systemd service that set it at boot, but I'm not sure if it's working. It sets the governor to performance at boot, then changes it to powersave after a few minutes. This is when using the intel_pstate driver.

Ubuntu uses a script, /etc/init.d/ondemand, to change the governor to ondemand (or powersave if there is no ondemand) after 1 minute. So you'll have to delete, or modify it, or add some other boot script that sleeps for more than 1 minute before changing the governor back.

The default, defined by the Ubuntu kernel configuration file, is the performance governor during boot.

Related Question