Search by Tags

CPU Frequency (Linux)

 

Compare with Revision

Subscribe for this article updates

The Linux Kernel supports dynamic voltage and frequency switching (DVFS) in order to minimize power usage. Generally, the feature should remain enabled; however, if power consumption and heat dissipation aren't an issue and low latency is required, it might make sense to disable frequency scaling.

Change CPU frequency behavior by using an appropriate governor:

root@apalis-t30:~# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
conservative userspace powersave ondemand performance
root@apalis-t30:~# echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Change CPU frequency behavior by setting the CPU frequency explicitly:

root@apalis-t30:~# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
51000 102000 204000 370000 475000 620000 760000 860000 1000000 1100000 1200000 1300000 1400000
root@apalis-t30:~# echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
root@apalis-t30:~# echo 860000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

The system will adjust to an appropriate voltage according to frequency. Please note that depending on the board/die temperature, thermal throttling might limit the current frequency in use.

Alternatively use the cpufreq userspace tools as follows to achieve the same results:

root@colibri-imx6:~# cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: imx6-cpufreq
  CPUs which run at the same hardware frequency: 0 1
  CPUs which need to have their frequency coordinated by software: 0 1
  maximum transition latency: 72.0 us.
  hardware limits: 396 MHz - 792 MHz
  available frequency steps: 396 MHz, 792 MHz
  available cpufreq governors: interactive, conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 396 MHz and 792 MHz.
                  The governor "interactive" may decide which speed to use
                  within this range.
  current CPU frequency is 396 MHz (asserted by call to hardware).
  cpufreq stats: 396 MHz:46.32%, 792 MHz:53.68%  (61)
analyzing CPU 1:
  driver: imx6-cpufreq
  CPUs which run at the same hardware frequency: 0 1
  CPUs which need to have their frequency coordinated by software: 0 1
  maximum transition latency: 72.0 us.
  hardware limits: 396 MHz - 792 MHz
  available frequency steps: 396 MHz, 792 MHz
  available cpufreq governors: interactive, conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 396 MHz and 792 MHz.
                  The governor "interactive" may decide which speed to use
                  within this range.
  current CPU frequency is 396 MHz (asserted by call to hardware).
  cpufreq stats: 396 MHz:46.32%, 792 MHz:53.68%  (61)
root@colibri-imx6:~# cpufreq-set -g userspace
root@colibri-imx6:~# cpufreq-set -f 396000000