Someone moved three lines of code in Linux 7.2 and got a 5% storage speed increase


Summary

  • Linux 7.2 gains ~5% IOPS on ext4/xfs thanks to a small code change.

  • Skipping an unnecessary iomap memory set after the iteration freed up write bandwidth.

  • Moving three lines to run the subsequent iteration shows that small edits can improve performance.

Making sure your code works at its best can be quite daunting if you’re not sure what to remove and to what extent. However, sometimes the stars align and you discover a really simple solution that significantly increases the speed of your software. However, as good as it is, not many people can claim to have sped up a process by 5% simply by moving three pieces of code down a few lines, which is exactly what a Linux engineer achieved with version 7.2 of the kernel.

Linux 7.2 saw a 5% increase in storage speed by moving three lines of code

It was a very shocking movement, but a movement nonetheless.

example-of-three-lines-of-linux

How he saw it ForonyxThis change was written by Fengnan Chang and performed by Christian Brauner. In Brauner Confirmation Notesmentions the work Chang had done on the kernel and how he helped develop Linux 7.2:

Skip the iomap memset in iomap_iter() after the iteration is complete. In high IOPS scenarios (4k rand read NVMe polling via io_uring), the useless memset was wasting memory write bandwidth; this improves IOPS by about 5% on ext4 and xfs.

If you’re feeling a little lost after that, IOPS stands for “Input/Output Operations Per Second” and is basically the speed at which your storage drive sends and receives data. Getting a 5% speed boost from the Linux kernel is really impressive, to say the least.

Funnily enough, that’s not the best part of this story. The most interesting part is how Chang solved it. You can see the change in the image above and inside the confirm recordsbut Chang essentially took three lines of code and moved them to trigger after the process had finished instead of before. Just like that, IOPS rates increased by 5%. I wish all my debugging initiatives were this easy but meaningful.

Linux 7.1 just came out last weekend, so this fix won’t hit our PCs until 7.2 is released in August 2026. However, it’s great to see 7.2 already shaping up to be interesting so quickly.


A Linux laptop that runs Windows applications, specifically Adobe Photoshop and Microsoft Word.

Linux 7.1 just eliminated one of the biggest headaches of dual booting

Now you have no excuse not to try Linux.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *