Usama Arif keeps finding speed hidden in plain sight inside the Linux kernel’s Zstandard implementation. Last month he exposed an embarrassing repeated CPUID check that wasted cycles on every compression and decompression operation. Now he has followed up with two small patches that eliminate another pointless initialization step. The changes target the crypto subsystem’s Zstd acomp driver and should reach the mainline in the Linux 7.4 merge window.
The latest work focuses on cstream and dstream objects. In the current code an initialization call happens before the first use. That first call gets thrown away without processing any data. The new approach waits until the first walk iteration to set up the stream. Simple change. Measurable payoff.
According to benchmarks included in the patch cover letter, the update produces single-digit gains in compression speed on a 4KB crypto_acomp test. Decompression fares better. Bare metal sees a 13 percent speed-up. Virtual machines record a 35 percent improvement. Those are the kinds of numbers that matter when Zstd handles page cache traffic in Btrfs, serves SquashFS images, or powers initramfs decompression.
And this is not an isolated fix. Arif’s previous series, covered by Phoronix on 26 August 2026, tackled BMI2 instruction detection. The kernel had been running CPUID twice per context creation to decide between generic and accelerated code paths. On modern Intel and AMD processors that support BMI2, the check was pure overhead. The fix cut decompression time by 71 percent and compression by 18 percent in the same crypto_acomp benchmark. Those three patches have already been merged.
Taken together, Arif’s recent contributions expose how much performance had been left on the table through small but repeated inefficiencies. The kernel’s copy of Zstd has long lagged behind the upstream Facebook library. Version 1.5.7 finally landed in Linux 6.15 last year, bringing better small-block compression and new APIs for Intel QAT hardware acceleration. Yet even after that update, basic housekeeping issues remained.
The crypto/zstd code initializes a fresh context for many operations. SquashFS calls into decompression for every block. Btrfs, EROFS and F2FS do the same per write or read. Each time the redundant initialization ran. Each time cycles disappeared. Deferring that work until it is actually required removes the waste without altering behavior or adding complexity.
Developers familiar with the code note that the patch series is tiny. Two patches. Clean diff. The cover letter points to the exact location of the discarded initialization and shows before-and-after numbers. No new features. Just less work.
The patches were picked up quickly into the cryptodev Git branch this week. That branch feeds the cryptography subsystem and typically flows into the next merge window. Linux 7.4 looks set to include both the BMI2 probing fix and this stream initialization improvement. For server operators running Zstd-compressed filesystems or containers, the gains will arrive without any configuration change.
Interest in these fixes has already surfaced on X. Phoronix itself highlighted the patch on 13 September 2026, noting the nice improvements for both bare metal and VM usage. Related discussion continues around Btrfs read performance and the earlier redundant page cache write issue that Arif also addressed.
Zstandard’s appeal in the kernel has grown steadily. It offers a strong balance of speed and ratio compared with older options like gzip or lz4. Btrfs adopted it for transparent compression. SquashFS and EROFS use it for read-only images. The kernel itself can be compressed with Zstd for faster boot. Every cycle saved in these paths compounds across millions of systems.
Yet the in-kernel implementation has sometimes felt like an afterthought. Updates came irregularly. The code base drifted from upstream. The addition of David Sterba as co-maintainer earlier this year signaled a desire to close that gap. Arif’s targeted optimizations show what focused attention can achieve even before a full rebase.
Future work may bring more upstream features into the kernel tree. Intel continues to expand QAT support for Zstd offload. Newer hardware generations promise native acceleration for both compression and decompression. But those gains depend on a clean, efficient software foundation. Removing redundant initialization is exactly the sort of housekeeping that makes higher-level improvements possible.
The patches themselves live in the cryptodev branch. Reviewers have offered little pushback. The changes are conservative and the performance data is clear. For an industry that spends considerable effort chasing single-digit percentage wins in storage and virtualization, these fixes represent easy money.
So the Linux kernel’s Zstd code gets a bit lighter. A bit quicker. And the pattern is now familiar. Find the hidden waste. Remove it. Measure the difference. Repeat. Arif has done it twice in quick succession. Expect more to follow.
Linux Kernel Zstd Code Sheds Redundant Work, Delivering Faster Compression in Version 7.4 first appeared on Web and IT News.
Shotwell has long served as the default photo manager for many Linux distributions built on…
The BFS filesystem, a component of the Linux kernel for many years, is scheduled for…
A one-line change in the memory management code has closed a bug that quietly discarded…
Developers compiling the Linux kernel day after day know the drill. Hours slip by as…
Arnd Bergmann has spent years steering the ARM side of the Linux kernel. Now his…
Linus Torvalds released Linux 7.3-rc3 last week. He called it another fairly large release candidate.…
This website uses cookies.