{
  "slug": "zswap",
  "term": "zswap",
  "aliases": [
    "Linux zswap",
    "Compressed swap cache"
  ],
  "definition": "zswap is a Linux compressed-memory cache for swap pages that can defer writes to a backing swap device.",
  "note": "The swap subsystem offers pages to a dynamically allocated compressed pool; zswap is not a separate block device. Eviction can send pages to backing swap, so enabling the cache does not guarantee zero storage writes. Compression uses CPU time, and its benefit depends on the workload. [zswap-v612]\n\nDisabling zswap at runtime stops new stores but does not immediately empty existing compressed entries. Cached pages remain until invalidated or faulted back into memory. [zswap-v612]\n\nAccounting consequence: each cached page retains a swap entry identified by its swap type and offset. The compressed pool therefore does not add swap address capacity to the configured backing area. [zswap-v612]\n\nPer-cgroup writeback permission and swap admission are separate controls. See memory.swap.max for the Linux 6.12 disabled-backend exception and zero-page path; a quiet swap device alone cannot identify which path handled a page. [page-io-v612] [memcontrol-v612]",
  "related": [
    "tmpfs",
    "zram",
    "swapfile",
    "transparent-memory-offloading",
    "memory-swap-max"
  ],
  "citations": [
    {
      "id": "zswap-v612",
      "title": "Linux 6.12: zswap, backing swap and runtime disabling",
      "url": "https://docs.kernel.org/6.12/admin-guide/mm/zswap.html",
      "accessed": "2026-11-14"
    },
    {
      "id": "memcontrol-v612",
      "title": "Linux v6.12 memcontrol.c: swap_max_write, swap charging and mem_cgroup_zswap_writeback_enabled",
      "url": "https://github.com/torvalds/linux/blob/v6.12/mm/memcontrol.c",
      "accessed": "2026-12-01"
    },
    {
      "id": "page-io-v612",
      "title": "Linux v6.12 page_io.c: swap_writepage zeromap, zswap and writeback ordering",
      "url": "https://github.com/torvalds/linux/blob/v6.12/mm/page_io.c",
      "accessed": "2026-12-01"
    }
  ],
  "advantages": [],
  "limitations": [],
  "provenance": [
    "Linux 6.12 documentation: overview and design sections. Configuration and distribution defaults may differ.",
    "The capacity distinction is inferred from the documented swap-entry-to-pool mapping, not from a capacity or memory-pressure experiment."
  ],
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-12-01"
}
