Sep 142010

green linuxNo, I do not want to talk of Linux MINT, but as is practically possible to apply some tricks to make our desktop a bit more nature oriented.

However let me say that thanks to your choice of Linux operating system you are already on the philosophical choice closer to nature:

  • Requires less resources: Linux distributions require an average of fewer resources, and the hardware can be used for longer.
  • KM 0: The Open Source philosophy relies heavily on volunteers who work from home and contribute to various projects.
  • Less packaging: Linux is mainly distributed via downloads and manuals are in digital format.
  • More cheap: In Linux you have many freely available software so you don’t  have to work to buy them.

But now back on practice in particular we’ll see

  • The tickless kernel, which enables the processor to sleep between tasks
  • PowerTop to check what’s consuming more energy

Tickless Idle


Traditionally, the Linux kernel used a periodic timer for each CPU. This timer did a variety of things, such as process accounting, scheduler load balancing, and maintaining per-CPU timer events. Older Linux kernels used a timer with a frequency of 100Hz (100 timer events per second or one event every 10ms), while newer kernels use 250Hz (250 events per second or one event every 4ms) or 1000Hz (1000 events per second or one event every 1ms).

This periodic timer event is often called “the timer tick”. The timer tick is simple in its design, but has a significant drawback: the timer tick happens periodically, irrespective of the processor state, whether it’s idle or busy. If the processor is idle, it has to wake up from its power saving sleep state every 1, 4, or 10 milliseconds. This costs quite a bit of energy, consuming battery life in laptops and causing unnecessary power consumption in servers.

With “tickless idle”, the Linux kernel has eliminated this periodic timer tick when the CPU is idle. This allows the CPU to remain in power saving states for a longer period of time, reducing the overall system power consumption.

It’s important to note that the benefits of tickless idle will be lost if the CPU is frequently awakened by unnecessary timer events. There are variety of enhancements and patches over the basic tickless idle feature that provide incremental power savings.

Although the tickless kernel is often enabled by default, you can check to see if you have it enabled with the following command:

cat /boot/config-$(uname -r) | grep CONFIG_NO_HZ

If the output is CONFIG_NO_HZ=y, the tickless kernel is enabled. CONFIG_NO_HZ=n means that it is not.

Ubuntu 10.04:

The -generic kernel is 250Hz and I believe the server kernel is 100Hz but, the -rt kernel is compiled for 1000Hz, generic and rt have both CONFIG_NO_HZ=y.

Check your kernel, perhaps if it’s source compiled you have forgot this useful option.

Check also:

Tickless Idle

The Impact Of A Tickless Kernel


PowerTOP is a Linux tool that finds the software component(s) that make your laptop use more power than necessary while it is idle. As of Linux kernel version 2.6.21, the kernel no longer has a fixed 1000Hz timer tick. This will (in theory) give a huge power savings because the CPU stays in low power mode for longer periods of time during system idle.

However… there are many things that can ruin the party, both inside the kernel and in userspace. PowerTOP combines various sources of information from the kernel into one convenient screen so that you can see how well your system is doing, and which components are the biggest problem.


For PowerTOP to work best, use a Linux kernel with the tickless idle (NO_HZ) feature enabled (version 2.6.21 or later).

PowerTOP works best on a laptop computer, or at least a computer with an Intel mobile processor (certain small non-laptop devices also contain a mobile processor). When using PowerTOP on a laptop, do so when running on battery.


C state information

C-states are operating modes of the CPU when it’s idle. The higher the C-state number, the less power is used by the CPU; however the longer it will take to get the CPU back to executing instructions.

C0 is special–in C0, the CPU is actually executing instructions. In all other C-states, the CPU is idle and not executing instructions.

To get decent power savings during idle, the CPU should be in C3 or C4 most of the time. In addition, the longer the average time in these C-states, the more power is saved. Ideally, your CPU spends at least 95% of its time in C4, for an average of 50 or more milliseconds.

In the screenshot, the laptop isn’t doing very well. Most of the time the processor is in C2, and then only for an average of 4.4 milliseconds at a time. If the laptop spent most of its time in C4 for at least 20 milliseconds, the battery life would have been approximately one hour longer.

Wakeups per second

The “Wakeups per second” line is another indicator for how well your laptop is doing in terms of getting power savings: the lower the number the better. When running a full GNOME desktop, 3 wakeups per second is achievable.

The laptop in the screenshot is not doing very well (193 is a lot more than 3!), which obviously matches the C-state results.

< strong>Power usage

When your laptop is running on battery, PowerTOP uses ACPI to collect information on how much power you are currently using. In addition, PowerTOP calculates an estimate for how many hours of battery you have left.

Note: If you’re not running on battery, or not running PowerTOP on a laptop, this information will not be available.

Top causes for wakeups

Now that we know the laptop is not doing well in terms of power usage, it’s time for the interesting part: what is causing the system to be more active than needed.

PowerTOP displays the top 10 activities on the computer during the sampling period. In the screenshot, the top 3 items are hardware interupts from devices. This also shows one of the key reasons the laptop isn’t doing well– it was connected to the network via an ethernet cable, yet the ipw2200 wireless driver was waking the CPU up very frequently. Also shown is a bug in the i915 graphics driver and activity by the i8042 component (this is the PS/2 chip; the activity shown is the mouse moving to make the screenshot).

The screenshot also shows that on this laptop, Firefox, xchat and Xorg are very active and causing a significant amount of power-consuming activity.


The last section of the screen displays suggestions– PowerTOP has detected that the running kernel is configured suboptimally and suggests how to improve this.

There are some nice tips and tricks on powertop site:

Green Linux

The Green Linux Initiative is not a software but it’s a working group organized by the Linux Foundation to improve power management in Linux. The working group is facilitating collaboration among kernel developers, hardware manufacturers, system vendors, distributions, and end users to understand and address the requirements for more effective power management in Linux. Better power management is a requirement for nearly every Linux environment.

For mobile devices and laptop computers, Green Linux can mean significantly enhanced battery life as well as better performance, such as near instantaneous suspend/resume. For desktops and servers, improved power management can result in significant decreases in operating costs. Better power management in virtualized environments enables more virtual machines to share the same hardware. In many data center environments, power and the heat that it generates is the limiting factor for both processing power and cost. In living room set top boxes, the customer usually wants to limit heat production because of noise from fans or because the device has no fan at all. In all cases, less power consumption is better for the environment.

Popular Posts:

Flattr this!

  4 Responses to “Linux for a green desktop”

  1. Edifying article. Thank you.

  2. Thanks to both, while writing this article i noticed that my Kernel on the Laptop (Gentoo 64 bit) was missing the tickless feature.

  3. […] Questo è un piccolo followup dal mio articolo Linux Desktop “verde” […]

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>