memory.reclaim
memory.reclaim is a cgroup v2 control file that requests proactive memory reclaim from a target group without setting a persistent usage limit.
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. [1]
Progress 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. [2]
Small 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. [2] [3] [4]
Return-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. [2]
Relations
Citations
- Linux 6.12 cgroup v2: proactive reclaim, EAGAIN and socket balancing
- Linux v6.12 memory_reclaim: page quantization, cumulative progress and nbytes return
- Hesela: constructed page-size boundary examples, not host measurements
- Hesela: executable request-to-page arithmetic
Sources & caveats
- 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.