April 21st, 2025

Reworking 30 lines of Linux code could cut power use by up to 30 percent

Researchers at the University of Waterloo have optimized the Linux kernel to reduce data center energy consumption by up to 30%, enhancing efficiency for network-heavy applications with minimal code changes.

Read original articleLink Icon
CuriositySkepticismEnthusiasm
Reworking 30 lines of Linux code could cut power use by up to 30 percent

Researchers at the University of Waterloo have developed a method to reduce energy consumption in data centers by up to 30% through a simple coding adjustment in the Linux operating system. Martin Karsten and his team identified inefficiencies in how the Linux kernel processes network traffic, particularly during low traffic periods when unnecessary polling consumes CPU power. By reorganizing the existing code rather than writing new lines, they created a dynamic system that adjusts polling based on network activity. This optimization, which involves about 30 lines of modified code, has been integrated into the Linux kernel version 6.13 released in January 2023. The changes are particularly beneficial for applications that rely heavily on network communication, making them more energy-efficient. The researchers aim to promote their findings at upcoming conferences and encourage other developers to adopt similar strategies in their web servers. This initiative reflects a growing focus on sustainability and efficiency in software development, a shift from the previous emphasis on performance alone.

- A coding tweak in the Linux kernel can reduce data center energy use by up to 30%.

- The optimization involves reorganizing existing code rather than creating new lines.

- The changes have been implemented in Linux kernel version 6.13.

- The method is especially effective for network-dominant applications.

- The research highlights a renewed focus on software efficiency and sustainability.

AI: What people are saying
The comments on the article about the optimized Linux kernel reveal several key insights and concerns regarding its impact on energy efficiency in data centers.
  • Many commenters note that the 30% energy savings may not apply universally, as some high-performance workloads bypass the Linux kernel entirely.
  • There is a discussion about the implications of busy polling and its inefficiencies, particularly when the system is not under heavy load.
  • Some users express a desire for more efficient coding practices in the industry, emphasizing the importance of energy efficiency alongside performance.
  • Several comments highlight the need for clearer communication in the article's title to avoid confusion about the scope of the optimization.
  • There are inquiries about how to enable the new power-saving feature, indicating interest in practical implementation.
Link Icon 24 comments
By @ryao - 18 days
Linux added a busy polling feature for high performance networking. Most Linux software does not use it, but software used in datacenters (e.g. by CDNs) that does use it makes the system very energy inefficient when things are not busy. This patch gives the the kernel the ability to turn that off when not busy to regain energy efficiency until things become busy again.

The article name is somewhat misleading, since it makes it sound like this would also apply to desktop workloads. The article says it is for datacenters and that is true, but it would have been better had the title ended with the words “in datacenters” to avoid confusion.

By @hwpythonner - 18 days
One thing I didn’t see mentioned here yet: a lot of high-performance data center workloads don’t actually go through the Linux kernel’s network stack at all.

Instead, they use DPDK, XDP, or userspace stacks like Onload or VMA—often with SmartNICs doing hardware offload. In those cases, this patch wouldn’t apply, since packet processing happens entirely outside the kernel.

That doesn’t mean the patch isn’t valuable—it clearly helps in setups where the kernel is in the datapath (e.g., CDNs, ingress nodes, VMs, embedded Linux systems). But it probably won’t move the needle for workloads that already bypass the kernel for performance or latency reasons. So the 30% power reduction headline is likely very context-dependent.

By @corbet - 18 days
For a more detailed look at this change: https://lwn.net/Articles/1008399/
By @queuebert - 18 days
This is really cool. As a high-performance computing professional, I've often wondered how much energy is wasted due to inefficient code and how much that is a problem as planetary compute scales up.

For me, it feels like a moral imperative to make my code as efficient as possible, especially when a job will take months to run on hundreds of CPU.

By @linsomniac - 18 days
Does this mean that "adaptive interrupt mitigation" is no longer a thing in the kernel? I haven't really messed with it in ~15+ years, but it used to be that the kernel would adapt, if network rate was low it would use interrupts, but then above a certain point it would switch to turning off interrupts and using polling instead.

The issue I was trying to resolve was sudden, dramatic changes in traffic. Think: a loop being introduced in the switching, and the associated packet storm. In that case, interrupts could start coming in so fast that the system couldn't get enough non-interrupted time to disable the interrupts, UNLESS you have more CPUs than busy networking interfaces. So my solution then was to make sure that the Linux routers had more cores than network interfaces.

By @wrsh07 - 18 days
The flip side of this is meta having a hack that keeps their GPUs busy so that the power draw is more stable during llm training (eg don't want a huge power drop when synchronizing batches)
By @endorphine - 18 days
Off topic: glad to read about Joe Damato again — such a blast from the past. I haven't read anything from him since I first read James Gollick posts about on tcmalloc and then learning about packagecloud.io which eventually led me to Joe's amazing posts.
By @ssuds - 18 days
Key paragraph: "This energy savings comes with a caveat. “It is sort of a best case because the 30 percent applies to the network stack or communication part of it,” Karsten explains. “If an application primarily does that, then it will see 30 percent improvement. If the application does a lot of other things and only occasionally uses the network, then the 30 percent will shrink to a smaller value.”"
By @Dwedit - 18 days
When your sentence contains "Up To", literally anything is possible.
By @didgetmaster - 18 days
By @infogulch - 18 days
Wow busy waiting is more resource intensive than I realized.
By @jeffbee - 18 days
When a machine is large enough with enough tenants, there should be enough ambient junk going on to poll on 1 or a few cores and still be optimized for power. This is the tradeoff described in the 2019 "SNAP" paper from Google, in the section about the compacting engine.

The "up to 30%" figure is operative when you have a near-idle application that's busy polling, which is already dumb. There are several ways to save energy in that case.

By @secondcoming - 18 days
I thought that Intel added the ‘pause’ instruction to make busy spinning more power friendly
By @rvz - 18 days
> When I grew up in computer science in the 90s, everybody was concerned about efficiency...“Somehow in the last 20 years, this has gotten lost. Everybody’s completely gung-ho about performance without any regard for efficiency or resource consumption. I think it’s time to pivot, where we can find ways to make things a little more efficient.

This is the sort of performance efficiencies I want to keep seeing on this site, from those who are distinguished experts and contributed to critical systems such as the Linux kernel.

Unfortunately, in the last 10-15 years we are seeing the worst technologies being paraded due to a cargo-cultish behaviour. From asking candidates to implement the most efficient solution to a problem in interviews but then also choosing the most extremely inefficient technologies to solve certain problems because so-called software shops are racing for that VC money. Money that goes to hundreds of k8s instances on many over-provisioned servers instead of a few.

Performance efficiency critically matters, and it is the difference between having enough runway for a sustainable business vs having none at all.

And nope. AI Agents / Vibe coders could not have come up with a more correct solution in the article.

By @gradientsrneat - 16 days
I love how I can update Linux and expect it to get faster, not slower. Exception to be made for Nvidia drivers, but at least their performance is consistent.
By @mintflow - 18 days
Oh, as a guy which was using DPDK like technology that do busy-poll and bypass kernel to process network packets, I must say may be much power have be wasted...
By @mrbluecoat - 18 days
Noob question: how do you enable this power saving feature? Is it just upgrading to the latest kernel?
By @RecycledEle - 18 days
I'd like to see clearly explained Linux boot code that does not invoke a prayer to Satan.
By @Jeaye - 18 days
Niiice. What if we reworked 100 lines?
By @ikekkdcjkfke - 18 days
Leverage porn
By @d3Xt3r - 18 days
> The code has been implemented as part of the Linux kernel release version 6.13 in January.

This is basically 3 month old news now.