Power efficiency is a growing concern for data centers running multiple Linux servers. The more you know about the PowerTOP 2 utility, the more insight you can glean into Linux power consumption, helping to optimize servers.
CPUs, C-States and power usage
You cannot do much to influence the way in which a program uses power, although the Linux kernel does try to optimize power usage. What you can do is move system components around the data center's servers to optimize power usage based on the information PowerTOP provides.
Using PowerTOP 2 to view power consumption
The PowerTOP 2 utility lists active programs and drivers, as well as their power usage. This list can show, for example, that a module or program you don't even need on your server is responsible for the highest power consumption. With this information, you can blacklist the kernel module or completely remove the program from your system to significantly cut power usage.
The Summary line across the top of the PowerTOP Overview window shows the Linux power consumption broken down by average wakeups per second, number of actions the graphical processing unit and virtual file system can perform, as well as the percentage of CPU usage. Based on this information, you can decide immediately where to target power reduction efforts. In the example in Figure 1, the monitored system has many wakeups per second that can be tracked down to the libvirtd, virt-manager and kvm processes.
Power consumption statistics in PowerTOP 2
PowerTOP 2's statistics information shows what the CPU cores are doing and in which C-state. It is nice to see the summaries per CPU core, but in most cases this won't help you improve power performance for a server.
The Frequency stats tab lets you relate specific C-states to the clock frequency that a CPU is using. Discover how efficient the CPU frequency is in low-usage cases. You can expect modern CPUs to step down to a lower frequency when the workload is light (see Figure 2). If the amount of work suddenly increases, the CPU's C-state will change. On my test system, this was revealed by launching the command dd if=/dev/zero of=/dev/null, a CPU-intense command that puts one CPU core in turbo mode to perform the task as fast as possible.
Linux power optimization and tuning
To optimize Linux power consumption, you first need to find out which system components are using the most power. For some devices, the driver provides power-tuning options. You can find an overview of these options on the Tunables tab, find the right parameter and switch it on or off. To change the current value for a setting, select it and hit Enter. The change will be applied and you'll be able to see instantly whether it has the effect you want.
Apart from the parameters that you can change directly from the PowerTOP interface, there are many other options to consider. Imagine that on a particular server file system drivers cause a lot of activity. Your best option might be to switch file systems. On a specific workload, an advanced Linux file system such as btrfs may need many more routines to do its work compared with a simpler file system such as ext3. In such situations, create a test environment and play with the different parameters.
This was first published in July 2013