Difference between revisions of "Cpufrequtils"

From ArchWiki
Jump to navigation Jump to search
(use i18n template)
Line 165: Line 165:
{{Note|Adjusting only {{Codeline|cpu0}} should work fine on multi-core systems, as other entries that belong to the same physical processor are adjusted automatically.}}
{{Note|Adjusting only {{Codeline|cpu0}} should work fine on multi-core systems, as other entries that belong to the same physical processor are adjusted automatically.}}
{{Note|Starting with 2.6.33 adjusting only one is deprecated and will produce a warning message: {{Codeline|CPUFREQ: Per core ondemand sysfs interface is deprecated - up_threshold
}} {{Codeline|echo "50" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold}} should be used instead}}
=== Daemon ===
=== Daemon ===

Revision as of 13:48, 9 April 2010

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary end

Template:Package Official is a set of utilities designed to assist CPU frequency scaling, a technology used primarily by notebooks that enables the operating system to scale the CPU speed up or down, depending on the current system load and/or power scheme. For instance, CPU frequency scaling can run a 2GHz processor at 1GHz when a notebook is on battery power, thereby conserving battery life and lowering core temperatures.

When used in conjunction with pm-utils, notebook owners are provided with a complete power management suite.

Note that cpufrequtils is not the only way one can manage/throttle one's CPU. powernowd is a simple alternative for adjusting the speed of your CPU depending on system load.

This article covers installation and basic configuration of the cpufrequtils package.

Note: cpufrequtils is not the same as cpufreqd. Never run both cpufreqd and cpufreq daemons.


The Template:Package Official package is available in the [extra] repository:

# pacman -S cpufrequtils


Configuring CPU scaling is a 3-part process:

  1. Load appropriate CPU frequency driver
  2. Load desired scaling governor(s)
  3. Configure and load frequency scaling daemon (optional)

CPU frequency driver

In order for frequency scaling to work properly, the operating system must first know the limits of the CPU(s). To accomplish this, a kernel module is loaded that can read and manage the specifications of the CPU(s).

Most modern notebooks and desktops can simply use the acpi-cpufreq driver. However, other options include the p4-clockmod, powernow-k6, powernow-k7, powernow-k8, and speedstep-centrino drivers. To see a full list of available drivers, run the following:

$ ls /lib/modules/*/kernel/arch/*/kernel/cpu/cpufreq
Tip: For an AMD "K10" CPU like Phenom X4, use the powernow-k8 driver.

To load the CPU frequency driver manually:


# modprobe acpi-cpufreq

For older Intel CPUs, the command above may return with:

FATAL: Error inserting acpi_cpufreq ([...]/acpi-cpufreq.ko): No such device

In this case, replace the kernel module acpi-cpufreq with speedstep-centrino, p4-clockmod or speedstep-ich.

Notice that the speedstep-centrino module is deprecated.

There is a kernel with the speedstep-centrino module patched on the AUR, it is the kernel26-pentium-m package which is located here: http://aur.archlinux.org/packages.php?ID=33104


# modprobe powernow-k{6,7,8}

Not all of the powernow-k* drivers may be available or necessary. If loading one of them fails, try loading them individually.

Closing notes

To load the driver automatically at startup, add the appropriate driver to the MODULES array within Template:Filename. For example:

MODULES=( acpi-cpufreq vboxdrv fuse fglrx iwl3945 ... )

Once the appropriate cpufreq driver is loaded, detailed information about the CPU(s) can be displayed by running:

$ cpufreq-info

The output should appear similar to the following:


Monitoring the CPU speed in real-time can be achieved by running:

watch grep \"cpu MHz\" /proc/cpuinfo

Scaling governors

Governors can be thought of as pre-configured power schemes for the CPU. These governors must be loaded as kernel modules in order to be seen by such programs as kpowersave and gnome-power-manager. One may load as many governors as desired (only one will be active at any given time).

Available governors:

Template:Codeline (default)
The performance governor is built into the kernel and runs the CPU(s) at maximum clock speed
Template:Codeline (recommended)
Dynamically increases/decreases the CPU(s) clock speed based on system load
Similar to Template:Codeline, but more conservative (clock speed changes are more graceful)
Runs the CPU at minimum speed
Manually configured clock speeds by user

Add the desired governor(s) to the MODULES array in Template:Filename:

MODULES=(acpi-cpufreq cpufreq_ondemand cpufreq_powersave vboxdrv fuse fglrx iwl3945 ... )

Alternatively, manually set the governor by running the Template:Codeline command (as root). However, this setting will not be saved after a reboot/shutdown. For example:

# cpufreq-set -g ondemand

Run Template:Codeline or Template:Codeline for more information.

Interaction with ACPI events

Users may configure scaling governors to switch automatically based on different ACPI events such as connecting the AC adapter or closing a laptop lid. Events are defined in Template:Filename. If the Template:Package Official package is installed, the file should already exist and be executable. For example, to change the scaling governor from Template:Codeline to Template:Codeline when the AC adapter is disconnected and change it back if reconnected:


Changing the Template:Codeline governor's threshold

To change when the Template:Codeline governor switches to a higher multiplier, one can manipulate Template:Filename. Determine the current setting by issuing the following command as root:

# cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold

The value returned should be 95, the default setting as of kernel version 2.6.31. This means that the Template:Codeline governor currently increases the clock rate if a core reaches 95% utilization. The can be changed, for example:

# echo 50 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold

The governor will now switch to a higher clock rate if a core reaches 50% utilization.

To re-apply this setting during boot, add the command to Template:Filename.

Tip: One user found it necessary to use Template:Codeline or the command would fail with a "path not found" message during boot.
Note: Adjusting only Template:Codeline should work fine on multi-core systems, as other entries that belong to the same physical processor are adjusted automatically.
Note: Starting with 2.6.33 adjusting only one is deprecated and will produce a warning message: Template:Codeline Template:Codeline should be used instead


cpufrequtils also includes a daemon which allows users to set the desired scaling governor and min/max clock speeds for all processor cores at boot-time, without the need for additional tools such as kpowersave.

Before starting the daemon, edit Template:Filename as root, selecting the desired governor and setting the min/max speed for your CPU(s), for example:


Note: The exact min/max values of the CPU(s) can be determined by running Template:Codeline after loading the CPU driver (e.g. Template:Codeline). However, these values are optional. Users may omit them entirely by deleting or commenting out the min/max_freq lines; scaling will work automatically.

With the appropriate configuration, start the daemon with the following command:

# /etc/rc.d/cpufreq start

To start the daemon automatically at startup, add Template:Codeline to the DAEMONS array in Template:Filename, for example:

DAEMONS=(syslog-ng hal cpufreq dhcdbd networkmanager !network !netfs @alsa @crond @cups @fam @ntpd @sshd)


  • Some applications, like ntop, do not respond well to automatic frequency scaling. In the case of ntop it can result in segmentation faults and lots of lost information as even the Template:Codeline governor cannot change the frequency quickly enough when a lot of packages suddenly arrive at the monitored network interface that cannot be handled by the current processor speed.
  • Some CPUs may suffer from poor performance with the default settings of the Template:Codeline governor (e.g. flash videos not playing smoothly or stuttering window animations). Instead of completely disabling frequency scaling to resolve these issues, the aggressiveness of frequency scaling can be increased by lowering the up_threshold sysctl variable for each CPU. See #Changing the ondemand governor's threshold.