Tiny Core Extensions > TCE Tips & Tricks

Cpu frequency scaling basics

(1/7) > >>

bmarkus:
CPU FREQUENCY SCALING BASICS
To reduce power consumption is essential for portable computers but there are no reason not to use on desktop machines. You can save power turning off not needed hardware components like WiFi, Bluetooth, turning off or reduce monitor backlight, spinning down HDD and to control CPU frequency.

CPU frequency scaling is built into 2.6 kernel and available with Tiny Core also, but you need few additional tools and you have to setup it yourself. Most of the modern CPU's and chipsets support frequency scaling, there is a high chance that you can use it.

It is a short introductory article how to enable and use it. There are plenty of additional recources on the net.


TOOLS REQUIRED

You need the cpufreq.tczl extension and its dependencies from the repository.


CPU DRIVER

Next you have to load the proper CPU kernel driver matching your CPU. To identify the CPU type in a terminal window:

cat /proc/cpuinfo

Depending on the CPU, load one of the following modules with the 'modprobe' command:

p4-clockmod (Intel)
powernow-k6 (AMD K6)
powernow-k7 (AMD K7)
powernow-k8 (AMD K8)

If you choose a wrong driver you will get an error message and module is not loaded, nothing goes wrong.

Alternatively you can try

acpi-cpufreq

It is not so efficient as CPU specific modules, but better than nothing.

There are drivers for certain chipsets not only for CPU's but it is out of the scope of this introduction.


VIEW CPU FREQUENCY INFORMATION

Now you can check actual CPU frequency and other information. Type in a terminal window:

cpufreq-info

and you will get a similar screen:




GOVERNORS

Governors are kernel modules changing the CPU frequency. There are different governors implementing different rules:

powersave - sets the lowest possible frequency constantly
performance - sets the possible highest frequency constantly
ondemand - changes frequency automatically based upon actual demand of programs
conservative - same as ondemand but with a different algorithm, better for notebook battery
use
userspace - allows userspace programs (or any process running as root) to set the frequency

Above governors are modules, loaded automatically when needed, but you can modprobe them before using. Default is performance.

For most systems, the Ondemand governor can provide the best compromise between heat emission, power consumption, performance, and manageability. When the system is only busy at specific times of the day, the Ondemand governor will automatically switch between maximum and minimum frequency depending on the load without any further intervention.


SELECT GOVERNOR

At this point everything is prepared but no active governor selected and no running third party daemon installed, so no any power saving yet.

Use the 'cpufreq-set' command to activate one of the governors mentioned above, for example:

cpufreq-set -g ondemand

Please note, if you have a dual-core or multiple-core CPU, you must specify explicitely the CPU. There are CPU's where each core can run with different setting! Example for a dual-core CPU:

cpufreq-set -c 0 -g conservative
cpufreq-set -c 1 -g conservative

You can explicitely specify the frequency also.


MAN PAGES

You can read man pages here:

http://linux.die.net/man/1/cpufreq-info
http://linux.die.net/man/1/cpufreq-set


USER SPACE PROGRAMS

There are user space programs to manage not only cpu frequency but other components also. One of those, cpufreqd is part of the cpufreq.tcel/tcpufreq.tczl extension installed.

For the curious there are many good articles on the net.

Hope it helps a bit to understand and use frequency scaling.

Juanito:
Thanks for the info


--- Quote from: bmarkus on July 07, 2009, 01:32:54 AM ---Alternatively you can try

acpi-cpufreq

It is not so efficient as CPU specific modules, but better than nothing.

--- End quote ---

I thought acpi-cpufreq had taken over from the speedstep module to be the module usually required for Intel cpu's, but I may be mistaken


--- Quote ---Now you can check actual CPU frequency and other information.

--- End quote ---

If you load the cpufreq_stats and freq_table modules, you can also see a whole bunch of data

bmarkus:

--- Quote from: Juanito on July 07, 2009, 03:53:01 AM ---Thanks for the info


--- Quote from: bmarkus on July 07, 2009, 01:32:54 AM ---Alternatively you can try

acpi-cpufreq

It is not so efficient as CPU specific modules, but better than nothing.

--- End quote ---

I thought acpi-cpufreq had taken over from the speedstep module to be the module usually required for Intel cpu's, but I may be mistaken


--- End quote ---

As far as I know acpi-cpufreq is not Intel specific. There are many contrversary info found on the net. For example REDHAT is advising to use it over p4-clockmode as it reduce not only CPU speed but voltage. On forums there are user reports that acpi-cpufreq doesn't work with certain machines even if equipped with Intel dual-core, can't recognize all possible CPU frequency therefore less efficient, ...

Regarding speedstep I have no experience, I have never used. However there are some info in Wikipedia:

http://en.wikipedia.org/wiki/SpeedStep

For sure one has to play around on the specific machine and fine tune frequency scaling. The good point that if module doesn't match hardware will not load so it is safe to play with different modules.

bmarkus:
Just found an interesting IBM document released in June 2009 on the topic:

http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/topic/liaai/cpufreq/liaai-cpufreq_pdf.pdf

pema:
I would recommend powernowd, solves everything in a zap, why bother with the crapy cpufreq ?

Navigation

[0] Message Index

[#] Next page

Go to full version