Meta Developing Compressed RAM 'CRAM' For Linux: Better Than ZRAM and Zswap?
Phoronix reports on a presentation this week by Meta engineer Gregory Price at the Linux Plumbers Conference in Prague: With today's memory shortages, high prices, and ever increasing memory capacity needs, Meta engineers have been working on Compressed RAM ("CRAM") for Linux. This hardware-offloaded compression still allows cacheline/byte access to compressed memory and in turn a better…
Meta engineer Gregory Price presented Compressed RAM, or CRAM, at the Linux Plumbers Conference in Prague. The technology aims to address memory shortages and high costs by offering a hardware-offloaded compression solution for Linux. CRAM maintains cacheline/byte access to compressed memory, potentially outperforming ZRAM and Zswap.
CRAM demonstrates near-native DRAM speeds for end-users who may already use Zswap or ZRAM. Read-only data is as fast as raw DRAM performance, while memory writes are significantly faster than ZRAM, Zswap, or plain swap. Most components needed for CRAM are already mainlined in the kernel.
CRAM utilizes a private NUMA node (essentially, a ghost CPU) instead of emulating a block device. This allows Linux to continue using its memory semantics, including migration and ballooning, to manage CRAM. Being stored in RAM with full cacheline/byte access, CRAM can be accessed in read-only mode with minimal delay, primarily limited by hardware-offloaded compression.
When writes are enabled, CRAM still outperforms ZRAM by a factor of 5.4x in the worst tested case of 20% writes. However, the significant performance dropdown comes from the need to page fault and migrate folios back to the original NUMA domain – direct writes to compressed data are not possible, as this would corrupt the data. While Meta Platforms is the primary target for CRAM development, the technology could benefit various Linux systems, including constrained devices like the Steam Deck.
Distributions often enable ZRAM or Zswap by default on machines. It is hoped that CRAM will find its way into the kernel once implementation questions are addressed, potentially offering a considerable speed-up for some Linux machines.
Written by urgent.news from Slashdot's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.