zram
zram is a Linux block-device driver that provides compressed RAM-backed storage with optional writeback to a configured backing device.
A zram device can hold a filesystem or serve as swap. Its logical disksize differs from compressed payload size and actual RAM allocation. The mm_stat counters distinguish represented data, compressed payload and allocator usage; mem_limit controls the pool separately. [1]
With CONFIG_ZRAM_WRITEBACK and a configured backing device, selected pages can be written out of RAM. Consequently, neither the device name nor its logical capacity proves that all data remains in RAM. [1]
In Linux v6.12, mem_used_total counts zsmalloc pool pages; the per-slot table is allocated separately. Same-filled pages retain a repeated word in that table without allocating a payload object. Zero payload allocation therefore does not imply zero device memory cost. [2]
Relations
Citations
- Linux 6.12: zram, memory accounting and optional writeback
- Linux v6.12 zram driver: pool accounting, slot table and same-filled pages
Sources & caveats
- Linux 6.12 documentation: usage, statistics and writeback sections; no compression ratio or workload speedup is assumed.
- Driver inspection of mm_stat_show, zram_meta_alloc and zram_write_page qualifies the memory-accounting scope; no allocation experiment was run.