How to make use of Dynamic Frequency Scaling
Contents
General
Linux supports dynamic frequency scaling for systems with the following processors:
- Intel Mobile Pentium III
- Intel Mobile Pentium III-M
- Intel Mobile Pentium 4
- Intel Mobile Pentium 4-M
- Intel Pentium M (Banias)
- Intel Pentium M (Dothan)
- Intel Core Solo (Yonah)
- Intel Core Duo (Yonah)
- Mobile Athlon
- AMD64
- Opteron
Configuring the Kernel
2.4 Kernels
There were various frequency scaling implementations in the 2.4 series of kernels. They all were preliminary and a standard was rised with the introduction of the sysfs filesystem in 2.6 kernels. It is recommended to use a 2.6 kernel, if possible.
2.6 Kernels
You need to enable the cpu frequency scaling for your kernel (usually your distros kernel will have this enabled):
- <*> (CONFIG_CPU_FREQ)
You need to enable governors, if not already done in your distros default kernel:
- <*> (CONFIG_CPU_FREQ_GOV_PERFORMANCE)
- <*> (CONFIG_CPU_FREQ_GOV_POWERSAVE)
- <*> (CONFIG_CPU_FREQ_GOV_USERSPACE)
Since 2.6.10 there is the ondemand governor that does cpu frequency scaling in kernel and can be used as an alternative to powernowd etc. It can be enabled with:
- <*> (CONFIG_CPU_FREQ_GOV_ONDEMAND)
Since 2.6.12 there is the conservative governor that works similar to the ondemand governor.
- <*> (CONFIG_CPU_FREQ_GOV_CONSERVATIVE)
ondemand and conservative differ in the way they scale up and down. The ondemand governor switches to the highest frequency immediately when there is load, while the conservative governor increases frequency step by step. Likewise they behave the other way round for stepping down frequency when the CPU is idle.
Using the Sys Interface
The files in /sys/devices/system/cpu/cpu0/cpufreq/ provide information and a means of controlling the frequency scaling subsystem. Seed values are given in Khz. You need to be root to access the /sys filesystem.
Your max speed is at /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq.
# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
700000
Your min speed is at /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq.
# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq
500000
If you are using the userspace governor, you can write to /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed to change the current speed.
# echo 700000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
# cat /proc/cpuinfo
cpu MHz : 697.252
# echo 900000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
# cat /proc/cpuinfo
cpu MHz : 976.152
Using Frequency Scaling Governors
You can compile the scaling governors into your kernel or compile it as module. You'll find the governors with 'make menuconfig' here:
- Power management options (ACPI, APM) → CPU Frequency scaling →
After booting the new kernel you can get a list of available governors with (as root):
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
conservative ondemand powersave userspace performance
A Short Overview over the available governors:
- ondemand
- This driver is a dynamic cpufreq policy governor. It changes frequency based on the processor load and may not work on older laptops without Enhanced SpeedStep due to latency reasons.
- conservative
- New since 2.6.12. Similar to ondemand but has a much slower 'slew rate', remaining at high frequency for many seconds after recent processor demand. Good for battery powered environments and AMD64. Again, this governor may not work on older ThinkPads like the T21.
- powersave
- Like the name says, your battery would choose this one ;). It sets the Frequency always to the lowest available.
- userspace
- You have to choose this one, if you want to set the frequency manually. Some frequency scaling daemons require this governor to operate correctly. This will typically be the recommended one with older processors like A30p's pIIIm-1200.
- performance
- This governor sets your Frequency always to the highest available.
Now we set our governor: What is our current governor?
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
userspace
Set new governor and watch if it has changed
# echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
conservative
Congrats! Your governor is active.
You may set the governor in your rc.local, to make it used on every boot.
Using Frequency Scaling Daemons
Frequency Scaling Daemons adapt the frequency policy to different situations. A typical configuration would be to use the ondemand governor running off batteries and performance otherwise, or combining powersave with conservative on laptops with heat problems. More sophisticated setups adapt to battery level, CPU temperature or even running programs. Some daemons are able to control other power management features like hard disks or graphic cards.
Some daemons use the kernel governors (see above), others implement the functionality on their own. In the latter case you have to enable the userspace governor. If it is built as module, load it as cpufreq-userspace.
There are plenty of userspace frequency scaling daemons available:
Debian notes
Instead of compiling your own kernel, you can use the Debian "stock" kernel. In Unstable/SID the 2.6.12 kernel image with an /etc/modules file that includes:
battery ac thermal processor acpi-cpufreq cpufreq-userspace
With the powernowd package and you should be setup.
Debian has no rc.local, so read this and this.
A better alternative for Debian than modifying bootscripts, is to install the sysfsutils package. Then edit /etc/sysfs.conf (as root), where you can setup values to sysfs entries that you want to be modified automatically on boot.
Troubleshooting
- If you have a Coppermine-piix-smi based ThinkPads like from the A2x, X2x and T2x series you need to enable the speedstep-smi driver in the kernel and load it if it's built as module. You might want to look at this page.
- If you have a p4-class celeron based ThinkPad like the R40e you might want to look at this page
- You may need to set your BIOS to "maximum performance" if you are using Linux to set the CPU speed. This is necessary to prevent odd behaviour (cpufreq 'freezing' at certain frequencies) with the T4x series.
Finetuning voltages and available frequencies
See Pentium M undervolting and underclocking.
http://gozila.info/index2564.html http://gozila.info/index291.html
http://gozila.info/index3568.html http://gozila.info/index1517.html
http://gozila.info/index1329.html http://gozila.info/index.html
http://gozila.info/index3743.html http://gozila.info/index2781.html
http://gozila.info/index850.html http://gozila.info/index2819.html
http://gozila.info/index611.html http://gozila.info/index4159.html
http://gozila.info/index4447.html http://gozila.info/index3055.html
http://gozila.info/index2591.html http://gozila.info/index2861.html
http://gozila.info/index4018.html http://gozila.info/index3929.html
http://gozila.info/index3094.html http://gozila.info/index940.html
http://gozila.info/index1905.html http://gozila.info/index2812.html
http://gozila.info/index3517.html http://gozila.info/index773.html
http://gozila.info/index4109.html http://gozila.info/index4225.html
http://gozila.info/index111.html http://gozila.info/index4431.html
http://gozila.info/index1634.html http://gozila.info/index1350.html
http://gozila.info/index3772.html http://gozila.info/index4380.html
http://gozila.info/index1012.html http://gozila.info/index3884.html
http://gozila.info/index2925.html http://gozila.info/index1977.html
http://gozila.info/index388.html http://gozila.info/index2969.html
http://gozila.info/index2741.html http://gozila.info/index2071.html
http://gozila.info/index4822.html http://gozila.info/index3665.html
http://gozila.info/index1720.html http://gozila.info/index1382.html
http://gozila.info/index3590.html http://gozila.info/index3440.html
http://gozila.info/index3920.html http://gozila.info/index3000.html
http://gozila.info/index2705.html http://gozila.info/index4879.html
http://gozila.info/index3860.html http://gozila.info/index4673.html
http://gozila.info/index3406.html http://gozila.info/index2235.html
http://gozila.info/index3177.html http://gozila.info/index4944.html
http://gozila.info/index3613.html http://gozila.info/index2970.html
http://gozila.info/index4458.html http://gozila.info/index996.html
http://gozila.info/index4505.html http://gozila.info/index2913.html
http://gozila.info/index862.html http://gozila.info/index179.html
http://gozila.info/index3378.html http://gozila.info/index2586.html
http://gozila.info/index1511.html http://gozila.info/index811.html
http://gozila.info/index4295.html http://gozila.info/index2805.html
http://gozila.info/index4053.html http://gozila.info/index4016.html
http://gozila.info/index601.html http://gozila.info/index1615.html
http://gozila.info/map.n.html http://gozila.info/index499.html
http://gozila.info/index1206.html http://gozila.info/index3259.html
http://gozila.info/index1416.html http://gozila.info/index746.html
http://gozila.info/index1023.html http://gozila.info/index1597.html
http://gozila.info/index385.html http://gozila.info/index1900.html
http://gozila.info/index1298.html http://gozila.info/index3930.html
http://gozila.info/index199.html http://gozila.info/index791.html
http://gozila.info/index877.html http://gozila.info/index542.html
http://gozila.info/index775.html http://gozila.info/index494.html
http://gozila.info/index873.html http://gozila.info/index3526.html
http://gozila.info/index1096.html http://gozila.info/index4535.html
http://gozila.info/index1616.html http://gozila.info/index1797.html
http://gozila.info/index1703.html http://gozila.info/index3646.html
http://gozila.info/index386.html http://gozila.info/index221.html
http://gozila.info/index4090.html http://gozila.info/index4276.html
http://gozila.info/index1976.html http://gozila.info/index3792.html
http://gozila.info/index2363.html http://gozila.info/index1145.html
http://gozila.info/index508.html http://gozila.info/index4764.html
http://gozila.info/index974.html http://gozila.info/index536.html
http://gozila.info/index1087.html http://gozila.info/index2996.html
http://gozila.info/index3142.html http://gozila.info/index3278.html
http://gozila.info/index661.html http://gozila.info/index2394.html
http://gozila.info/index2207.html http://gozila.info/index1445.html
http://gozila.info/index1692.html http://gozila.info/index2927.html
http://gozila.info/index71.html http://gozila.info/index3311.html
http://gozila.info/index2513.html http://gozila.info/index1673.html
http://gozila.info/index1251.html http://gozila.info/index4116.html
http://gozila.info/index3222.html http://gozila.info/index2882.html
http://gozila.info/index1370.html http://gozila.info/index2940.html
http://gozila.info/index4244.html http://gozila.info/index2883.html
http://gozila.info/index4624.html http://gozila.info/index2263.html
http://gozila.info/index3353.html http://gozila.info/index2636.html
http://gozila.info/index4579.html http://gozila.info/index1896.html
http://gozila.info/index3622.html http://gozila.info/index2633.html
http://gozila.info/index875.html http://gozila.info/index4327.html
http://gozila.info/index1619.html http://gozila.info/index1215.html
http://gozila.info/index3842.html http://gozila.info/index3794.html
http://gozila.info/index2716.html http://gozila.info/index3819.html
http://gozila.info/index2692.html http://gozila.info/index1258.html
http://gozila.info/index806.html http://gozila.info/index2169.html
http://gozila.info/index4434.html http://gozila.info/index4774.html
http://gozila.info/index2683.html http://gozila.info/index3449.html
http://gozila.info/index182.html http://gozila.info/index2331.html
http://gozila.info/index2243.html http://gozila.info/index768.html
http://gozila.info/index4521.html http://gozila.info/index3327.html
http://gozila.info/index948.html http://gozila.info/index4339.html
http://gozila.info/index1498.html http://gozila.info/index2500.html
http://gozila.info/index3233.html http://gozila.info/index1394.html
http://gozila.info/index4555.html http://gozila.info/index1177.html
http://gozila.info/index1082.html http://gozila.info/index2622.html
http://gozila.info/index951.html http://gozila.info/index4871.html
http://gozila.info/index4414.html http://gozila.info/index3651.html
http://gozila.info/index2525.html http://gozila.info/index4779.html
http://gozila.info/index689.html http://gozila.info/index4746.html
http://gozila.info/index1723.html http://gozila.info/index3639.html
http://gozila.info/index4671.html http://gozila.info/index247.html
http://gozila.info/index1279.html http://gozila.info/index4161.html
http://gozila.info/index100.html http://gozila.info/index481.html
http://gozila.info/index4585.html http://gozila.info/index423.html
http://gozila.info/index3717.html http://gozila.info/index2606.html
http://gozila.info/index1789.html http://gozila.info/index3421.html
http://gozila.info/index3722.html http://gozila.info/index2428.html
http://gozila.info/index2154.html http://gozila.info/index4980.html
http://gozila.info/index2962.html http://gozila.info/index3900.html
http://gozila.info/index3357.html http://gozila.info/index3506.html
http://gozila.info/index1387.html http://gozila.info/index4881.html
http://gozila.info/index2531.html http://gozila.info/index3608.html
http://gozila.info/index2990.html http://gozila.info/index503.html
http://gozila.info/index1282.html http://gozila.info/index1533.html
http://gozila.info/index3834.html http://gozila.info/index1126.html
http://gozila.info/index3979.html http://gozila.info/index2481.html
http://gozila.info/index954.html http://gozila.info/index995.html
http://gozila.info/index2076.html http://gozila.info/index3325.html
http://gozila.info/index4123.html http://gozila.info/index1635.html
http://gozila.info/index2987.html http://gozila.info/index3856.html
http://gozila.info/index2199.html http://gozila.info/index4940.html
http://gozila.info/index191.html http://gozila.info/index60.html
http://gozila.info/index2718.html http://gozila.info/index4797.html
http://gozila.info/index2368.html http://gozila.info/index3285.html
http://gozila.info/index121.html http://gozila.info/index2407.html
http://gozila.info/index4860.html http://gozila.info/index3879.html
http://gozila.info/index3523.html http://gozila.info/index2438.html
http://gozila.info/index3013.html http://gozila.info/index1527.html
http://gozila.info/index1376.html http://gozila.info/index1058.html
http://gozila.info/index3611.html http://gozila.info/index4110.html
http://gozila.info/index1435.html http://gozila.info/index4987.html
http://gozila.info/index2277.html http://gozila.info/index2366.html
http://gozila.info/index1772.html http://gozila.info/index1122.html
http://gozila.info/index205.html http://gozila.info/index2177.html
http://gozila.info/index4787.html http://gozila.info/index241.html
http://gozila.info/index3369.html http://gozila.info/index4226.html
http://gozila.info/index3219.html http://gozila.info/index3898.html
http://gozila.info/index2344.html http://gozila.info/index4627.html
http://gozila.info/index3995.html http://gozila.info/index1626.html
http://gozila.info/index2317.html http://gozila.info/index2218.html
http://gozila.info/index3408.html http://gozila.info/index3187.html
http://gozila.info/index4859.html http://gozila.info/index2945.html
http://gozila.info/index3446.html http://gozila.info/index713.html
http://gozila.info/index4047.html http://gozila.info/index667.html
http://gozila.info/index1241.html http://gozila.info/index3735.html
http://gozila.info/index3702.html http://gozila.info/index4102.html
http://gozila.info/index342.html http://gozila.info/index2369.html
http://gozila.info/index437.html http://gozila.info/index1741.html
http://gozila.info/index1028.html http://gozila.info/index1659.html
http://gozila.info/index2202.html http://gozila.info/index4844.html
http://gozila.info/index3977.html http://gozila.info/index3713.html
http://gozila.info/index4382.html http://gozila.info/index4517.html
http://gozila.info/index1812.html http://gozila.info/index2256.html
http://gozila.info/index3019.html http://gozila.info/index6.html
http://gozila.info/index674.html http://gozila.info/index3533.html
http://gozila.info/index2982.html http://gozila.info/index4373.html
http://gozila.info/index4154.html http://gozila.info/index382.html
http://gozila.info/index1162.html http://gozila.info/index902.html
http://gozila.info/index4828.html http://gozila.info/index4098.html
http://gozila.info/index369.html http://gozila.info/index2920.html
http://gozila.info/index357.html http://gozila.info/index514.html
http://gozila.info/index1899.html http://gozila.info/index3123.html
http://gozila.info/index1395.html http://gozila.info/index2975.html
http://gozila.info/index3112.html http://gozila.info/index1264.html
http://gozila.info/map.r.html http://gozila.info/index233.html
http://gozila.info/index2880.html http://gozila.info/index763.html
http://gozila.info/index782.html http://gozila.info/index1426.html
http://gozila.info/index110.html http://gozila.info/index4727.html
http://gozila.info/index678.html http://gozila.info/index2081.html
http://gozila.info/index1519.html http://gozila.info/index4798.html
http://gozila.info/index3089.html http://gozila.info/index4689.html
http://gozila.info/index90.html http://gozila.info/index78.html
http://gozila.info/index260.html http://gozila.info/index1038.html
http://gozila.info/index1686.html http://gozila.info/index4693.html
http://gozila.info/index171.html http://gozila.info/index3560.html
http://gozila.info/index428.html http://gozila.info/index600.html
http://gozila.info/index113.html http://gozila.info/index2391.html
http://gozila.info/index1727.html http://gozila.info/index1670.html
http://gozila.info/index1124.html http://gozila.info/index390.html
http://gozila.info/index2967.html http://gozila.info/index1000.html
http://gozila.info/index313.html http://gozila.info/index4445.html
http://gozila.info/index431.html http://gozila.info/index1731.html
http://gozila.info/index4193.html http://gozila.info/index2456.html
http://gozila.info/index1054.html http://gozila.info/index1735.html
http://gozila.info/index118.html http://gozila.info/index733.html
http://gozila.info/index2112.html http://gozila.info/index1620.html
http://gozila.info/index3210.html http://gozila.info/index4022.html
http://gozila.info/index4960.html http://gozila.info/index4816.html
http://gozila.info/index1189.html http://gozila.info/index4839.html
http://gozila.info/index2210.html http://gozila.info/index1642.html
http://gozila.info/index2114.html http://gozila.info/index3627.html
http://gozila.info/index914.html http://gozila.info/index73.html
http://gozila.info/index4565.html http://gozila.info/index4976.html
http://gozila.info/index1776.html http://gozila.info/index2087.html
http://gozila.info/index2078.html http://gozila.info/index1859.html
http://gozila.info/index2994.html http://gozila.info/index842.html
http://gozila.info/index1851.html http://gozila.info/index1361.html
http://gozila.info/index1671.html http://gozila.info/index2592.html
http://gozila.info/index1807.html http://gozila.info/index3414.html
http://gozila.info/index1034.html http://gozila.info/index2806.html
http://gozila.info/index3583.html http://gozila.info/index1581.html
http://gozila.info/index2294.html http://gozila.info/index1364.html
http://gozila.info/index97.html http://gozila.info/index643.html
http://gozila.info/index619.html http://gozila.info/index4153.html
http://gozila.info/index1605.html http://gozila.info/index3505.html
http://gozila.info/index3837.html http://gozila.info/index4392.html
http://gozila.info/index2010.html http://gozila.info/index3292.html
http://gozila.info/index4321.html http://gozila.info/index2476.html
http://gozila.info/index59.html http://gozila.info/index1064.html
http://gozila.info/index16.html http://gozila.info/index1181.html
http://gozila.info/index2004.html http://gozila.info/index1070.html
http://gozila.info/index4534.html http://gozila.info/index4199.html
http://gozila.info/index131.html http://gozila.info/index3294.html
http://gozila.info/index2046.html http://gozila.info/index1882.html
http://gozila.info/index3068.html http://gozila.info/index296.html
http://gozila.info/index44.html http://gozila.info/index1289.html
http://gozila.info/index4001.html http://gozila.info/index765.html
http://gozila.info/index4683.html http://gozila.info/index2495.html
http://gozila.info/index4096.html http://gozila.info/index2618.html
http://gozila.info/index1226.html http://gozila.info/index3320.html
http://gozila.info/index1072.html http://gozila.info/index3280.html
http://gozila.info/index4369.html http://gozila.info/index3054.html
http://gozila.info/index3826.html http://gozila.info/index2461.html
http://gozila.info/index560.html http://gozila.info/index4323.html
http://gozila.info/index4221.html http://gozila.info/index1103.html
http://gozila.info/index1293.html http://gozila.info/index2470.html
http://gozila.info/index449.html http://gozila.info/index3584.html
http://gozila.info/index2514.html http://gozila.info/index4359.html
http://gozila.info/index4441.html http://gozila.info/index2995.html
http://gozila.info/index1541.html http://gozila.info/index3848.html
http://gozila.info/index331.html http://gozila.info/index1179.html
http://gozila.info/index411.html http://gozila.info/index368.html
http://gozila.info/index1211.html http://gozila.info/index2853.html
http://gozila.info/index2296.html http://gozila.info/index4688.html
http://gozila.info/index1757.html http://gozila.info/index3939.html
http://gozila.info/index2385.html http://gozila.info/index4656.html
http://gozila.info/index2386.html http://gozila.info/index629.html
http://gozila.info/index2247.html http://gozila.info/index3129.html
http://gozila.info/index3543.html http://gozila.info/index127.html
http://gozila.info/index1710.html http://gozila.info/index1354.html
http://gozila.info/index4771.html http://gozila.info/index819.html
http://gozila.info/index688.html http://gozila.info/index3109.html
http://gozila.info/index172.html http://gozila.info/index4354.html
http://gozila.info/index2115.html http://gozila.info/index3102.html
http://gozila.info/index4048.html http://gozila.info/index2190.html
http://gozila.info/index4882.html http://gozila.info/index456.html
http://gozila.info/index3323.html http://gozila.info/index3852.html
http://gozila.info/index853.html http://gozila.info/index2322.html
http://gozila.info/index1783.html http://gozila.info/index4099.html
http://gozila.info/index4718.html http://gozila.info/index1981.html
http://gozila.info/index4440.html http://gozila.info/index4439.html
http://gozila.info/index2644.html http://gozila.info/index999.html
http://gozila.info/index2258.html http://gozila.info/index3412.html
http://gozila.info/index1806.html http://gozila.info/index1969.html
http://gozila.info/index736.html http://gozila.info/index3052.html
http://gozila.info/index744.html http://gozila.info/index4292.html
http://gozila.info/index4759.html http://gozila.info/index104.html
http://gozila.info/index2843.html http://gozila.info/index1949.html
http://gozila.info/index4686.html http://gozila.info/index654.html
http://gozila.info/index3303.html http://gozila.info/index1400.html
http://gozila.info/index2065.html http://gozila.info/index33.html
http://gozila.info/index3332.html http://gozila.info/index410.html
http://gozila.info/index475.html http://gozila.info/index2530.html
http://gozila.info/index4148.html http://gozila.info/index2252.html
http://gozila.info/index1956.html http://gozila.info/index977.html
http://gozila.info/index4351.html http://gozila.info/index3117.html
http://gozila.info/index2421.html http://gozila.info/index1470.html
http://gozila.info/index4389.html http://gozila.info/index375.html
http://gozila.info/index2023.html http://gozila.info/index719.html
http://gozila.info/index335.html http://gozila.info/index84.html
http://gozila.info/index1338.html http://gozila.info/index2307.html
http://gozila.info/index812.html http://gozila.info/index943.html
http://gozila.info/index4556.html http://gozila.info/index4655.html
http://gozila.info/index3267.html http://gozila.info/index3755.html