The introduction of the tickless kernel in Red Hat Enterprise Linux 6 (refer to
Section 3.4, “Tickless Kernel”) allows the CPU to enter the idle state more frequently, reducing power consumption and improving power management. The new
PowerTOP tool identifies specific components of kernel and userspace applications that frequently wake up the CPU.
PowerTOP was used in development to perform the audits described in
Section 3.11, “Optimizations in User Space” that led to many applications being tuned in this release, reducing unnecessary CPU wake up by a factor of ten.
Install PowerTOP with the command:
yum install powertop
Run PowerTOP with the command:
powertop
Note that you will need to run PowerTOP with root privileges to allow the application to do anything useful.
When it runs,
PowerTOP gathers statistics from the system and presents you with a list of the components that are sending wakeups to the CPU most frequently.
PowerTOP also makes suggestions for tuning the system for lower power consumption. These suggestions appear at the bottom of the screen, and specify a key for you to press to accept
PowerTOP's suggestion. As
PowerTOP refreshes periodically, further suggestions appear. In
Figure 2.1, “PowerTOP in Operation”, note the suggestion to
increase the VM dirty writeback time
, and the key (
W) to press to accept the suggestion.
When it runs, PowerTOP gathers statistics from the system and presents you with several important lists of information. At the top is a list of how long your CPU cores have been in each of the available C and P states. The longer the CPU stays in the higher C or P stats the better (C4
being higher than C3
) and is a good indicator of how well the system is tuned towards CPU utilization. Your goal should be residency of 90% or more in the highest C or P state while the system is idle.
The second piece of information is a summary of the actual wakeups per second of the machine. The number of wakeups per second gives you a good measure of how well the services or the devices and drivers of the kernel are performing with regard to power usage on your system. The more wakeups per second you have, the more power is consumed, so lower is better here.
Next, PowerTOP provides an estimate of the actual power usage of the system, if available. Expect PowerTOP to report this figure on laptops while they are in battery mode.
Any available estimates of power usage are followed by a detailed list of the components that send wakeups to the CPU most frequently. At the top of the list are those components that you should investigate more closely to optimize your system to reduce power usage. If they are kernel components, (indicated by the name of the component being listed in <
>
) then the wakeups are often associated with a specific driver that causes them. Tuning drivers most usually requires kernel changes which go beyond the scope of this document. However, userland processes that send wakeups are more easily managed. First, identify if this service or application should run at all on this system. If not, simply deactivate it. To turn off a service permanently, run:
chkconfig servicename
off
If you need more details about the what the component actually does, run:
ps -awux | grep componentname
strace -p processid
If the trace looks like it is repeating itself, then you probably have found a busy loop. To fix this would require a code change in that component and that again goes beyond the scope of this document.
Finally,
PowerTOP also makes suggestions for tuning the system for lower power consumption. These suggestions appear at the bottom of the screen, and specify a key for you to press to accept
PowerTOP's suggestion. As
PowerTOP refreshes periodically, further suggestions appear. In
Figure 2.1, “PowerTOP in Operation”, note the suggestion to
increase the VM dirty writeback time
, and the key (
W) to press to accept the suggestion. These changes will only be active until the next reboot. To help you make the changes permanent,
PowerTOP displays the exact command it runs to perform this optimization. Add the command to your
/etc/rc.local
file with your preferred text editor so that it takes effect every time that the computer starts.