HN
Today

Swap tables, flash-friendly swap, swap_ops, and more

The Linux kernel's long-neglected swap subsystem is undergoing a significant renovation, with developers focused on streamlining its architecture and improving performance. This multi-faceted effort involves reducing overhead, enhancing flash-friendliness, and abstracting the swap backend for greater flexibility. Hacker News readers are keen on these deep-seated kernel optimizations that promise more robust and efficient system operations.

6
Score
0
Comments
#11
Highest Rank
9h
on Front Page
First Seen
May 24, 11:00 AM
Last Seen
May 24, 7:00 PM
Rank Over Time
131112141415222022

The Lowdown

The Linux kernel's swap subsystem, responsible for managing anonymous pages in secondary storage, is experiencing a renaissance of developer interest. Recent discussions at the 2026 Linux Storage, Filesystem, Memory Management, and BPF Summit highlighted ongoing efforts to improve its performance, maintainability, and compatibility with modern storage.

  • Swap Subsystem Overhaul and Roadmap: Kairui Song presented significant changes, including the introduction of a swap table that reduced overhead from 3-11 bytes per page to 2-10 bytes, with an ambitious goal of reaching 0-3 bytes. Work is ongoing to unify folio allocation, improve readahead, and address issues with PMD-level huge pages and hibernation. A major long-term vision is a virtual swap layer to abstract much of the swap logic, enabling features like faster device removal and defragmentation.
  • Flash-Friendly Swapping: Youngjun Park showcased a solution for embedded devices to mitigate wear on solid-state drives caused by aggressive swapping. His approach involves compressing pages in RAM and flushing them to persistent storage using sequential, erase-block aligned writes, along with a deduplication layer. This drastically increases storage device lifetime by optimizing I/O patterns for flash.
  • Abstracting the Swap Backend (swap_ops): Chris Li (stepping in for Baoquan He) discussed the swap_ops concept, a virtual filesystem (VFS)-like layer for swap. This aims to modularize swap backends, allowing subsystems like zram to remove block device emulation and enabling custom, hardware-aware swap implementations. The goal is a lower-overhead, more flexible swap interface for various storage types.

These initiatives collectively point towards a future where the Linux kernel's swap mechanism is not only more performant and less resource-intensive but also more adaptable to diverse storage technologies and use cases, from traditional hard drives to embedded flash memory.