It is delicious blag. You must eat it!

A sexy blag about booze, boobs, stuff and redundant waffles.

Tips&Tricks: CPU frequency scaling in Arch Linux

March 12th, 2008 by yoshi

CPU frequency scaling is a nice thing in that it can reduce energy usage, heat and enhance notebook battery life while unplugged. For Windows you have Notebook Hardware Control (NHC), a nifty little tool that can do a lot of things for yer travel pal, from dynamic CPU scaling to graphic card control and some HDD settings (if I remember right, this one is available only in the Pro version) which can all be found here.

On Linux things get a bit more complicated (like almost anything you`d do with 1-2 clicks in Windows) . After a bit of experimenting this is what I have done to enable CPU scaling.

As root:

pacman -S cpufrequtils acpi-cpufreq

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. – ArchWiki

Load the driver (i.e. acpi-cpufreq) and the CPU power schemes:

modprobe <driver name>
modprobe <name of power scheme> (i.e. cpufreq_powersave, etc)

After that edit /etc/rc.conf and put acpi-cpufreq, freq_table and the power schemes(governors) in the MODULES array and cpufreq in the DAEMONS array.

MODULES=(acpi-cpufreq cpufreq_ondemand cpufreq_powersave cpufreq_userspace cpufreq_conservative freq_table sky2 iwl3945 ….

DAEMONS=(syslog-ng acpid hal cpufreq ….

You don’t need to load ALL the governors, just the ones you’re going to use.

Edit /etc/conf.d/cpufreq. You can comment/delete the min/max frequency settings if you want as they can be figured out automatically (I commented them and had no trouble so far). Set the governor you want (i.e. performance/conservative/powersave etc).

Start the cpufreq demon by typing:

/etc/rc.d/cpufreq start

You can use the following to change the governor:

cpufreq-set -g <governor name>

If you’re running a multicore CPU, like me, you can use:

cpufreq-set -c 0 -g <governor name>
cpufreq-set -c 1 -g <governor name>

and so forth for each core you wanna modify the governor for.

To check if the CPU frequency was scaled properly you can run

cpufreq-info

This will return the info about your CPU, something looking somewhat like this:

analyzing CPU 0:
driver: acpi-cpufreq
CPUs which need to switch frequency at the same time: 0
hardware limits: 1000 MHz – 1.67 GHz
available frequency steps: 1.67 GHz, 1.33 GHz, 1000 MHz
available cpufreq governors: conservative, powersave, userspace, ondemand, performance
current policy: frequency should be within 1000 MHz and 1.67 GHz.
The governor “userspace” may decide which speed to use
within this range.
current CPU frequency is 1000 MHz (asserted by call to hardware).

If you’re running XFCE you can add a panel applet to display the frequency and governor name if you wish.

I may have forgotten a step or two, so if stuff doesn`t work properly, read the wiki guides (like you should :P):

CPU Frequtils

Beginner’s guide – Configuring CPU frequency scaling

And if you want some extra things like suspend/hibernate/whatever when the notebook lid closes take a look at:

Acpid

Beginner`s guide – Additional tweaks for laptops

Posted in Geeky

One Response

  1. wooptoo

    Asta n-o stiam :)Probabil pentru ca am avut norocul sa prind printre ultimele procesoare Intel fara freq. scaling.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.