9 ms·
Reworking 30 lines of Linux code could cut power use by up to 30 percent
- d3Xt3r 1y ago> 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.
- ryao 1y agoIf you read the original commit comment, userspace software needs to opt into this: https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=80b6f094756f https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds... If it is not reported for people to know about it, this will do nothing. That said, the opt-in here is only relevant when software has already opted into busy polling, so it likely does not apply to software used outside of datacenters.
- Almondsetat 1y agoDid you know about this before reading the article?
- d3Xt3r 1y agoYes, it was posted before over here and other news sites. I've seen it reposted several times over the past three months.
- TheRealPomax 1y agoSo, new enough that millions of people never heard about it. I can see why it made the front page.
- matkoniecz 1y agoWhat is wrong with 3 month old news? I in fact prefer ones that are not repeated based only on basis being new and much more likely to be confused/misleading/hoax/lie/not actually interesting. Similarly, I prefer old books, old computer games, old movies (or at least not ones currently being hot/viral/advertised), this allows a lot of trash to self-filter out. Including trash being breathlessly promoted and consumed.
- d3Xt3r 1y agoWhat's wrong with it is the fact that it was already posted before over here and other news sites. I've seen it reposted several times over the past three months and I'm tired of seeing this. 6.13 is old news now, we're already on 6.14, and even 6.15 isn't far from release (we're already at rc3).
- throw-qqqqq 1y agoWell, I run Linux on both my laptops and desktops, consider myself an enthusiast etc., but I don’t track the development of the mainline Linux kernel closely enough to know what goes on there in the past three months. I may notice changes when they get adopted by upstream maintainers of my distro, but that usually takes time..
- d3Xt3r 1y agoThat doesn't make it okay to repost stale news. Would you be okay if I went to say phoronix.com, started picking other notable 3-month old Linux kernel articles and repost them here one by one? Heck, why limit myself just to the Linux kernel, why don't I just start reposting all the top headlines in the past few months, because surely not everyone is up-to-date on all the developments right?
- tverbeure 1y agoI'm one of the lucky 10,000.
- infogulch 1y agoWow busy waiting is more resource intensive than I realized.
- ryao 1y agoLinux 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.
- pelagicAustral 1y ago[flagged]
- sophacles 1y agoHow is Gnome in any way relevant to bring up in the context of the kernel networking stack? I mean I get it, you dislike Gnome for whatever reason and want to cast some shade - that part is clear. What I don't really understand is how you decided this context is somehow going to be received in a way to further your view... it's just so illogical that my reaction is "support the Gnome folks". Actually - due to this comment I just donated $50 to the GNOME Foundation. Either the guerilla marketing worked, or your mission failed - in any case I hope this was an effective lesson in messaging.
- queuebert 1y agoThis 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.
- toomuchtodo 1y agoMy experience with HPC is only tangential to being a sysadmin for data taking and cluster management for a high energy physics project; I am interested on your thoughts about using generative AI to search out for potentially power inefficient code paths in codebases for potential improvement.
- jeffbee 1y agoDon't send an LLM to do a profiler's job.
- deleted 1y ago[deleted]
- queuebert 1y agoI agree with this. For the completely uninitiated, taking the most critical code paths uncovered via profiling and asking an LLM to rewrite it to be more efficient might give an average user some help in optimization. If your code takes more than a few minutes to run, you definitely should invest in learning how to profile, common optimizations, hardware latencies and bandwidths, etc. With most everything I use at the consumer level these days, you can just feel the excessive memory allocations and network latency oozing out of it, signaling the inexperience or lack of effort of the developers.
- rvz 1y agoAbsolutely. It is unfortunate that many software engineers continue to dismiss this as "premature optimization". But as soon as I see resources or server costs gradually rising every month (even on idle usage) costing into the tens of thousands which is a common occurrence as the system scale, then it becomes unacceptable to ignore.
- corbet 1y agoFor a more detailed look at this change: https://lwn.net/Articles/1008399/ https://lwn.net/Articles/1008399/
- pouulet 1y agoAnd for even more details, you can look at the relevant patch: https://lwn.net/ml/all/20241021015311.95468-1-jdamato@fastly.com/ https://lwn.net/ml/all/20241021015311.95468-1-jdamato@fastly... The power efficiency seems to be limited to "network applications using epoll". The 30% the article talks about seems to be benchmarked on memcached, and here is the ~30 lines diff they're probably talking about: https://raw.githubusercontent.com/martinkarsten/irqsuspend/main/patches/memcached.patch https://raw.githubusercontent.com/martinkarsten/irqsuspend/m...
- mintflow 1y agoOh, 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...
- nly 1y agoStandard practice in all trading applications is to busy poll the NIC using a kernel bypass technology. Typically saves 2-3 microseconds going through the kernel network stack.
- jeffbee 1y agoWhen 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.
- danans 1y ago> The "up to 30%" figure is operative when you have a near-idle application that's busy polling, which is already dumb. That was my first thought, but it sounds like the OS kernel, not the application, has control over the polling behavior, right?
- wrsh07 1y agoThe 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)
- jack_riminton 1y agoI thought of this too. Iirc it was bigger problem because surging spikes in power and cooling were harder and more costly to account for. I'm not au fait with network data centres though, how similar are they in terms of their demands?
- wrsh07 1y agoI think the issue is exactly the spikiness because of how AC electricity works (whereas if the data centered were DC - eg wired through a battery - it wouldn't be an issue) I expect you're right that GPU data centers are a particularly extreme example
- Scipio_Afri 1y agoHave a link to an article talking about them doing this?
- wrsh07 1y agoI tried desperately to source this even before seeing your request. My current guess is that I heard it on a podcast (either a Dwarkesh interview or an episode of something else - maybe transistor radio? - featuring Dylan Patel). I'll try to re listen to top candidates in the next two weeks (a little behind on current episodes because I'm near the end of an audiobook) and will try to ping back if I find it. If too long has elapsed, update your profile so I can find out how to message you!
- ikekkdcjkfke 1y agoThat goes against separation of concerns. A separate utility must be created for that specific purpose, not hidden in some other part of the system
- endorphine 1y agoOff 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.
- deleted 1y ago[deleted]
- rvz 1y ago> 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.
- linsomniac 1y agoDoes 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.
- jeffbee 1y agoAdaptive IRQ moderation is a hardware feature. https://edc.intel.com/content/www/us/en/design/products/ethernet/perf-tuning-guide-800-series-linux/%E2%80%8Binterrupt-moderation/ https://edc.intel.com/content/www/us/en/design/products/ethe...
- surajrmal 1y agoWhich most networking hardware supports.
- totalkikedeath 1y ago[dead]
- didgetmaster 1y agoThis brings back memories. https://didgets.substack.com/p/finding-and-fixing-a-billion-bug https://didgets.substack.com/p/finding-and-fixing-a-billion-...
- secondcoming 1y agoI thought that Intel added the ‘pause’ instruction to make busy spinning more power friendly
- jeffbee 1y agox86 has always had PAUSE, what they did is they made the PAUSE way longer in Skylake-X which threw everyone off guard. But yeah, x86 ISA extensions cover this ground very well. Atom, the low-power server line, introduced UMWAIT and TPAUSE that enable cores to briefly enter a power-saving active state while waiting for something to happen. These instructions later came to mainstream Core and Xeon CPUs because Intel made those frankenchips with Atoms and Cores together.
- secondcoming 1y agoIt had REP NOP which is the same opcode as PAUSE, but on CPUs that supported it PAUSE does less work for the same effect. At least that's my understanding of it.
- Jeaye 1y agoNiiice. What if we reworked 100 lines?
- stavros 1y ago20%.
- teddyh 1y agoA manager went to the master programmer and showed him the requirements document for a new application. The manager asked the master: “How long will it take to design this system if I assign five programmers to it?” “It will take one year,” said the master promptly. “But we need this system immediately or even sooner! How long will it take if I assign ten programmers to it?” The master programmer frowned. “In that case, it will take two years.” “And what if I assign a hundred programmers to it?” The master programmer shrugged. “Then the design will never be completed,” he said. — Chapter 3.4 of The Tao of Programming, by Geoffrey James (1987)
- mrbluecoat 1y agoNoob question: how do you enable this power saving feature? Is it just upgrading to the latest kernel?
- hwpythonner 1y agoOne 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.
- bigfatkitten 1y agoThere are a whole lot of commodity 1-2U rack mount boxes running RHEL or CentOS or the like out there that are mostly idle, and which don’t do anything fancier in hardware than maybe checksum or VLAN offload.
- ssuds 1y agoKey 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.”"
- pyfon 1y agoI'd suggest a submission title change to "...cut networking software power use..." Not so sexy. But as a force multiplier that's still a lot of carbon probably.
- Dwedit 1y agoWhen your sentence contains "Up To", literally anything is possible.
- RecycledEle 1y agoI'd like to see clearly explained Linux boot code that does not invoke a prayer to Satan.
- ikekkdcjkfke 1y agoLeverage porn
- gradientsrneat 1y agoI 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.