VOOZH about

URL: https://www.phoronix.com/news/Linux-Kcompressd-Memory

⇱ Kcompressd Proposed For Accelerated Memory Compression On Linux - Phoronix


👁 Phoronix

Kcompressd Proposed For Accelerated Memory Compression On Linux

Written by Michael Larabel in Linux Kernel on 1 May 2025 at 10:24 AM EDT. 11 Comments
Mediatek engineers have proposed Kcompressd as a new addition to the Linux kernel to improve the efficiency of memory reclamation. Mediatek engineers testing these patches on their handheld Linux devices have found huge benefit in alleviating memory pressure and enhancing system responsiveness.

Posted to the Linux kernel mailing list yesterday was the memory management "MM" patch for the Linux kernel proposing Kcompressd as a little more than 100 lines of C code and the potential to have dramatic impact on memory reclaiming performance.

👁 Kcompressd


The patch from Mediatek engineer Qun-Wei Lin is summed up as:
"This patch series introduces a new mechanism called kcompressd to improve the efficiency of memory reclaiming in the operating system.

Problem:
In the current system, the kswapd thread is responsible for both scanning the LRU pages and handling memory compression tasks (such as those involving ZSWAP/ZRAM, if enabled). This combined responsibility can lead to significant performance bottlenecks, especially under high memory pressure. The kswapd thread becomes a single point of contention, causing delays in memory reclaiming and overall system performance degradation.

Solution:
Introduced kcompressd to handle asynchronous compression during memory reclaim, improving efficiency by offloading compression tasks from kswapd. This allows kswapd to focus on its primary task of page reclaim without being burdened by the additional overhead of compression.

In our handheld devices, we found that applying this mechanism under high memory pressure scenarios can increase the rate of pgsteal_anon per second by over 260% compared to the situation with only kswapd. Additionally, we observed a reduction of over 50% in page allocation stall occurrences, further demonstrating the effectiveness of kcompressd in alleviating memory pressure and improving system responsiveness."

Interesting work and hopefully Kcompressd or some evolution of it will ultimately make it into the mainline Linux kernel for helping with the handheld Linux gaming experience and for other Linux systems routinely under memory pressure.

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.