How does it choose how much and how often change the CPU frequency?
Nikolay Sturm: The idea is very simple, apmd needs to figure out when the CPU is busy and then raise its frequency to get maximum performance. Once the CPU is idle again, the frequency can be lowered to save energy and reduce the noise level. In practice however, this is more complicated. First, you need a good metric. Some people believe the system’s load is that metric, but that’s wrong. The load is just the average number of processes running plus the ones wanting to run. This does not tell us anything about the actual CPU usage. The kernel actually measures where the CPU spends its time, regular userland processing, nice userland processing, kernel processing, and interrupt handling. Another counter measures the amount of time the CPU is idle. And this is the correct value to look at. Unfortunately, this opens a new can of worms, as you are free to look at these counters as often as you want. The more often you look and possibly adjust the CPU frequency, the better your overall per