Search arXiv⌕ Search

arXiv · 2612.02176

Hotness Fragmentation Limits Linux Proactive Reclaim: An Experimental Study of Object Placement, zswap, and cgroup v2 memory.reclaim

Abstract

Data centers reclaim memory from running jobs to fit more work on each server, but Linux decides what to reclaim one 4 KiB page at a time while applications use memory one small object at a time. Banakar et al. (2026) call the resulting waste hotness fragmentation: a single frequently used object keeps an entire page resident, together with the cold bytes around it. This paper measures how much memory that costs a stock Linux kernel. A purpose-built C workload places the same number of hot 64-byte objects in a 4 GiB arena either scattered at random or packed contiguously, and a driver reclaims memory in steps through cgroup v2 memory.reclaim into zswap with disk writeback disabled. Across 36 runs (two layouts, hot sets of 1%, 5% and 20%, lz4 and zstd compressors, three repetitions), packing saved 40.0-69.7% of memory, while scattering saved 0-37.0%. At a 5% hot set the gap was 48.0% against 1.9% with lz4. With the compression ratio measured from zswap's counters, savings matched a simple model, the fraction of pages holding no hot object times one minus the inverse compression ratio, to within one percentage point in every configuration, and to within 0.02 points when measured against the arena alone. Reclaiming cold pages caused no lasting slowdown; reclaiming beyond them evicted hot pages that faulted straight back in, costing a median 1.3-2.7 times the baseline loop time while saving nothing. Two validity problems found during pilot runs, swap readahead and shared-cache timing noise, are reported with their fixes.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Lin Ju. 2026-12-01. Hotness Fragmentation Limits Linux Proactive Reclaim: An Experimental Study of Object Placement, zswap, and cgroup v2 memory.reclaim. https://searcharxiv.org/abs/2612.02176

Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite Search arXiv by Indiciae: BibTeX · RIS.

KEEP EXPLORING

Related papers

Lightning-Speed Futexes

In the Linux kernel, the futex primitive lets one or several threads sleep until another thread wakes them up. Futexes can be used to implement barriers, in which a futex wake-all is used to release all waiting threads. A wake-all is performed serially: the waker first waits on the lock that protects the list of sleeping threads, behind the threads it is about to wake, then walks a list of threads to collect the threads, and finally wakes them one at a time. We propose an approach that improves the performance of all three steps. Our approach places an abort gate in front of the lock, an admission stage that allows the waker to abort, in constant time, the lock acquisitions queued ahead of it; the waker then detaches the full set of waiters in one step instead of collecting them one by one; and finally it parallelizes the wake-ups by recruiting each woken thread to wake further threads. We implement our approach in the futex subsystem of Linux 6.19. On six Intel, AMD, and ARM servers, our approach speeds up the barrier-intensive NAS kernels by 1.3$\times$ to 1.9$\times$ on geometric mean, depending on the input class, and 45 barrier-heavy applications by 2.1$\times$ on geometric mean, with peak speedups of 4.4$\times$ and 6.2$\times$.

cs.OS↗

Write, Return, Reserve: KV Memory for Multi-User CPU LLM Servers under a Memory Budget

Memory limits how many requests a CPU language-model server can handle at once. llama.cpp commits its entire key-value (KV) cache before requests use it. Our kernel measurements identify start-up zero-filling and cache clearing as the cause. We adapt its multi-user server to commit pages on first write, return each finished request's pages to the kernel, and admit requests through an external proxy. The proxy reserves each request's maximum KV requirement, calculated from the model configuration, within a memory budget. In our tests, greedy output and perplexity match unmodified llama.cpp. For Qwen2.5-1.5B on identical requests with 16k context per slot and prompt caching disabled, unmodified llama.cpp uses 12.3 times as much peak memory. Across three sessions, we find no statistically detectable throughput difference (modified/unmodified ratio 0.996, 95% CI 0.92-1.08). Against unmodified llama.cpp running only the slots that fit and queueing other users, extra concurrency raises throughput 1.17-1.26x below CPU saturation. Once the CPU is saturated, throughput is similar. Requests start sooner, but each output token takes longer. We test 1-14B models on Intel and ARM. Of 199 outcomes predicted before testing, 179 match. We report every miss. Returning unused KV memory to the OS lets a CPU server handle more requests at once, but only improves throughput while the CPU has spare capacity.

cs.OS↗

Resolving an Idle-Time Accounting Hazard in Linux Load Balancing

The Linux kernel scheduler uses per-runqueue idle-time history (avg_idle) to decide whether searching other CPUs for runnable work justifies its execution overhead. This estimate is an active input to new-idle load balancing, helping determine whether a search continues across scheduling domains. This operational study presents the design and subsequent hardening of idle-time accounting through two upstream patch series. The original wakeup-side accounting missed legitimate idle exits associated with task creation, exec-related placement paths, and load-balancing migration. Introducing update_rq_avg_idle() and moving accounting to idle-task switch-out broadened coverage beyond wakeup-specific arrival paths. However, the broader consumer could also reach histories without a valid start timestamp. Subtracting zero from the runqueue clock constructs a sample unrelated to the measured idle interval and can rapidly saturate the bounded estimator, weakening new-idle balance cost gating. We describe the accounting redesign and its refinement using public development archives, patch iterations (v1-v8 and v1-v3), runtime tracing, independent review, and upstream integration records. A configuration-independent ttwu_pending history reaches the relocated consumer without a compatible measurement start. Core Scheduling force-idling and proxy execution further show why mechanically symmetric idle-entry timestamping is insufficient. From this incident and two retrospective scheduler cases, we extract a state-lifetime audit organized around missing establishment, premature consumption, and stale consumption. We distinguish these correctness findings from performance attribution, for which a controlled three-variant experiment remains necessary.

cs.OS↗