Dynamic CPU Power Management with cpufreq and schedutil (from Embedded Computing Design)

Dynamic CPU Power Management with cpufreq and schedutil

 

We are looking at how cpufreq and its most sophisticated governor, schedutil, allow the kernel to take advantage of Dynamic Voltage/Frequency Scaling (DVFS). cpufreq generally adopts the mantra “work when there is work to be done”. In other words, when there is a “demand” on the system, then the kernel will do its best to give these tasks the CPU time they require to perform the task. However, whenever the demand is less than 100% of the maximum CPU capacity, cpufreq will attempt to opportunistically save energy by slowing down some or all of the cores.

To simplify its design, cpufreq combines hardware-specific cpufreq drivers with generic cpufreq governors. The split allows mechanism and policy to be separated:

  • cpufreq drivers provide the mechanism to switch between different DVFS operating points and are typically partially- or fully-customized to a specific system-on-chip (SoC). They are also responsible for describing the available operating points, allowing the governor to make decisions.

    Different drivers invoke DVFS changes in different ways. Some directly manipulate the registers of power control hardware, whilst others work by sending messages to co-processors or supervisor-mode firmware requesting a change of power state. The thing typical cpufreq drivers (outside the x86 eco-system, see below) have in common is that they do what they are told and are not responsible for making decisions about what operating point to adopt. 

  • cpufreq governors provide the policy and are responsible for choosing the correct operating point from a list provided by the cpufreq driver.

    Some governors are very simple. For example, the performance and powersave governors will, respectively, run the CPU as fast or slow as possible. However, the more flexible governors, such as ondemand,  conservative, and schedutil, seek to estimate the current CPU load and will adjust the CPU frequency to match. For example, during media playback, the CPU wakes up to decode the audio and video but then goes to sleep until the video hardware is ready to accept the next frame. This may require only 50% of CPU capacity, so the ideal governor would select an operating point that is approximately half of the maximum frequency.

    schedutil stands apart from other complex governors and uses data captured by the scheduler to make decisions.

This was a guest post on EmbeddedComputing.com

Read the complete post here

Leave a Reply

Your email address will not be published. Required fields are marked *

Author

Daniel Thompson

Similar Blogs

Today's new hardware is impressive, but it’s easy to overlook the critical...
Power management is a fast changing topic that has become increasingly relevant...