{
  "slug": "memory-reclaim",
  "term": "memory.reclaim",
  "aliases": [
    "cgroup v2 proactive reclaim"
  ],
  "definition": "memory.reclaim is a cgroup v2 control file that requests proactive memory reclaim from a target group without setting a persistent usage limit.",
  "note": "Amount is a target: Linux 6.12 documents both over- and under-reclaim. Under-reclaim returns EAGAIN. Unlike memory.high, this interface does not establish a continuing throttle boundary. Proactive reclaim also does not trigger the usual socket-memory balancing response to memory pressure. [cgroup]\n\nProgress can precede failure: The v6.12 handler accumulates reclaimed pages, then may return EAGAIN after exhausted no-progress retries or EINTR after a pending signal. Neither error rolls back earlier reclaim. Retrying the original amount starts a new request, not a continuation with an automatically reduced target. This follows from source inspection, not a live reclaim experiment. [implementation]\n\nSmall requests: The handler divides parsed bytes by PAGE_SIZE with integer truncation. With 4096-byte pages, a valid request for 4095 bytes has a zero-page target and skips the reclaim loop; 4096 and 4097 both target one page. Other page sizes change the boundary. The accompanying executable examples expose the arithmetic without writing to a cgroup. [implementation] [examples] [code]\n\nReturn-value units: On success the handler returns nbytes, the length of the control-file input, not the amount reclaimed. A successful write is therefore not an exact-byte receipt. Observe memory and pressure over a defined interval; concurrent allocation and refaults can obscure a simple before/after usage difference. [implementation]",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-16",
  "status": "shipping",
  "related": [
    "transparent-memory-offloading",
    "pressure-stall-information"
  ],
  "citations": [
    {
      "id": "cgroup",
      "title": "Linux 6.12 cgroup v2: proactive reclaim, EAGAIN and socket balancing",
      "url": "https://docs.kernel.org/6.12/admin-guide/cgroup-v2.html",
      "accessed": "2026-11-16"
    },
    {
      "id": "implementation",
      "title": "Linux v6.12 memory_reclaim: page quantization, cumulative progress and nbytes return",
      "url": "https://github.com/torvalds/linux/blob/v6.12/mm/memcontrol.c#L4023-L4083",
      "accessed": "2026-11-16"
    },
    {
      "id": "examples",
      "title": "Hesela: constructed page-size boundary examples, not host measurements",
      "url": "https://hesela.dev/research/memory-reclaim-quantization.json",
      "accessed": "2026-11-16"
    },
    {
      "id": "code",
      "title": "Hesela: executable request-to-page arithmetic",
      "url": "https://hesela.dev/research/memory-reclaim-quantization.mjs",
      "accessed": "2026-11-16"
    }
  ],
  "provenance": [
    "Static review is pinned to Linux v6.12. Valid input and a successful control-file write are assumed for the sub-page example; access checks, syntax errors and distribution patches remain separate.",
    "The examples model only nonnegative byte-to-page conversion. They do not emulate the kernel parser, reclaim policy, memory accounting, device I/O or latency."
  ]
}
