How to use the max CPU frequency in Linux?

How to use the max CPU frequency in Linux?

The CPU frequency can be scaled up or down depending on the operating system's needs in order to save power. The CPU frequency can be automatically scaled depending on the system load, in response to ACPI events, or manually by userspace programs.

Whats cpupower utils?

cpupower?is a set of userspace utilities designed to assist with CPU frequency scaling.

Advantages and Disadvantages

adv :

  • While you can use the maximum CPU frequency without problem (Turbo Boost)
  • turbo boost under normal conditions does not effect the life expectancy of a CPU. It operates within the power and frequency limits set by the manufacturer and is perfectly safe.

disadv :

  • Battery life may be reduced if you use in a laptop

How to install the cpupower in some distro?

Ubuntu :

sudo apt-get install cpufrequtils

        

Fedora :

sudo dnf install kernel-tools        

Manjaro or Arch :

sudo pacman -S cpupower        

Other Distro : find package cpupower

How to Check cpupower frequency information?

?javad@dhcppc3 $ cpupower frequency-info
? ? ? ? ? ? ? ? ? ?
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: 800 MHz - 2.70 GHz
? available cpufreq governors: conservative ondemand userspace powersave performance schedutil
? current policy: frequency should be within 800 MHz and 2.70 GHz.
? ? ? ? ? ? ? ? ? The governor "powersave" may decide which speed to use
? ? ? ? ? ? ? ? ? within this range.
? current CPU frequency: Unable to call hardware
? current CPU frequency: 2.44 GHz (asserted by call to kernel)
? boost state support:
? ? Supported: yes
? ? Active: yes
? ? 25500 MHz max turbo 4 active cores
? ? 25500 MHz max turbo 3 active cores
? ? 25500 MHz max turbo 2 active cores
? ? 25500 MHz max turbo 1 active cores
        
?current policy: frequency should be within 800 MHz and 2.70 GHz.The governor "powersave" may decide which speed to use within this range.

As of now, the CPU is set to powersave and use a medium frequency, but performance governor is required to use the maximum frequency.

How do I set the frequency of the performance governor?

You can set performance governor with command, but after reboot, powersave will return. In the next step, we will set permanent governor.

sudo cpupower frequency-set -g performance

in Ubuntu with cpufrequtils:

sudo cpufreq-set -g performance        

How to set permanently performance governor?

cpupower :

sudo cpupower frequency-set -g performance

sudo systemctl enable cpupower

sudo systemctl start cpupower        

cpufrequtils :

sudo apt-get install cpufrequtils

echo 'GOVERNOR="performance"' | sudo tee /etc/default/cpufrequtils

sudo update-rc.d ondemand disable        



要查看或添加评论,请登录

Javad Rajabzadeh的更多文章

  • Bounds Check Elimination in golang

    Bounds Check Elimination in golang

    Go is a memory safe language. For array/slice indexing and subslicing operations, Go runtime checks whether the indices…

社区洞察

其他会员也浏览了