Linux's Page Cache May Stop Fighting Over Hot Files

A Linux RFC targets a hidden many-core bottleneck: the shared folio reference counter behind repeated reads of the same hot cached file data.

QuantumBytz Team
November 26, 2026
Share:
Linux performance engineer inspecting an open dual-socket server used to test concurrent reads from hot page-cache data.

Summary

A Linux memory-management RFC attacks an unusually specific scaling failure: many CPU cores repeatedly reading the same small, hot region of a file through read() or pread(). The storage is not slow. The data is already in RAM. What stalls is the bookkeeping around that data, as every reader increments and decrements the same folio reference counter and forces its cache line to move between cores.

Kiryl Shutsemau's 18-patch v2 series lets eligible reads copy from hot page-cache and tmpfs folios without taking that reference. Instead, a new PG_rcu_free flag delays reuse of the folio's memory until an RCU grace period has passed. In the author's most favorable 64-thread tests, repeated 16-byte reads rose from roughly 17-18 million to 69-71 million reads per second on ext4. The same patch set did nothing for several ordinary workloads and made some memory-pressure tests slower.[1]

That split result is the point. This is not a general Linux I/O speedup, and it has not been merged. It is a proposed fast path for workloads whose hottest shared object is not the file data but one atomic counter attached to it.

The page cache is already doing its job

A buffered file read normally lands in Linux's page cache. If the requested bytes are resident, the kernel can copy them from a cached folio into the caller's buffer without asking the storage device to do more work. A folio is the kernel's unit for treating one or more physical pages as a single memory-management object. The page-cache APIs normally return a folio with an increased reference count so it cannot disappear while a caller uses it.[2]

That lifetime rule is simple and safe. It also means every concurrent reader touches the same reference counter. On one core, the atomic increment and decrement are easy to overlook next to the system call and data copy. Across dozens of cores or multiple CPU sockets, ownership of the counter's cache line must move between caches. More threads can create more contention instead of more useful read throughput.

The proposed optimization is aimed at programs that make many small system-call reads from the same few cached pages while maintaining no private cache. Think of a service consulting a compact, shared read-only index, dictionary or metadata file from many worker threads. It is a narrower target than "databases" or "file servers." Applications that keep the hot data in their own address space never enter this path for each lookup.

The RFC's own negative results make that boundary clear. Kernel builds, SQLite and pgbench did not improve. Large sequential reads of a 256 MiB file were also effectively unchanged.[1] Those results are useful because they rule out the easy but misleading headline that the patch makes cached reads broadly faster.

RCU replaces a reference on the hot path

Removing a reference is only useful if the kernel can still prove that the memory remains valid while it is copied. The series uses read-copy update, or RCU, for that lifetime guarantee.

An RCU reader enters a read-side critical section, looks up the folio, verifies that it is still in the expected page-cache slot and copies the data. A folio marked PG_rcu_free may be logically freed during that interval, but its physical memory cannot be reused until all earlier RCU readers have passed through a quiescent state. That interval is the grace period. RCU is built for this pattern: readers run with little synchronization overhead, while reclamation waits until old readers can no longer hold a pointer.[3]

The RFC does not put every cached page on this deferred-free path. A folio first has to be recognized as hot through the existing access tracking. Cold and streaming data keep the regular behavior. The fast path also rejects folios that are not up to date, require readahead, are marked for drop-behind, contain poisoned pages or otherwise need slow-path handling.[1]

That selectivity matters. Deferring all page-cache frees would turn a read optimization into a memory-reclamation problem. Even the selective design needs new accounting. The patch set exposes NR_FREE_RCU_PAGES so memory waiting for a grace period is visible, and it can expedite a grace period when pending frees grow or memory becomes scarce. It drains those pages before allocation, compaction, memory-offline or out-of-memory paths give up.[1]

The supporting work is much larger than the final copy loop because memory lifetime bugs are unforgiving. The series adjusts splice and FUSE behavior so a page-cache folio cannot be repurposed underneath a lockless reader. It also handles memory failure and soft-offline cases, where the kernel may need to remove a damaged page while readers are active.[1]

The benchmark wins are real but deliberately extreme

The v2 results came from a 64-vCPU KVM guest on a Threadripper Pro 7975WX system. In one test, 64 threads each used a separate file descriptor to issue 16-byte pread() calls at offset zero. Ext4 throughput went from 17.1-18.1 million reads per second on the base kernel to 68.7-71.0 million with the series. Tmpfs rose from 1.5-1.9 million to 68.3-70.5 million because the base tmpfs path also serialized on a folio lock. A block-device test roughly doubled, but another shared lock remained in its path.[1]

Those are author-reported development benchmarks, not independent production measurements. They isolate the contention the patches were designed to remove. They do not say a typical application will run four times faster.

RocksDB's readrandom benchmark provides a more application-shaped example. With its block cache disabled and 64 threads hitting a tiny hot range, the RFC reports ext4 improving from roughly 10.6-10.9 million to 14.2-14.7 million operations per second. XFS rose from 8.9 million to about 12.2-12.4 million. Turn RocksDB's HyperClockCache back on and both kernels reached 26.5 million operations per second, because the database stopped asking the kernel page cache for every lookup.[1]

There were losses too. Under memory pressure, pgbench ran at 92-97 percent of the base kernel's performance. A stress workload that repeatedly read and dropped 1 GiB of hot data ran at 88 percent of base. The author reported no out-of-memory kills, but the slowdown shows that deferred reclamation has a cost when hot-page status and rapid eviction collide.[1]

Hardware mitigations also change the balance. The test notes that one short read paid about 400 nanoseconds at the user/kernel boundary on that machine. When the fixed syscall cost dominates, removing a contended reference produces a smaller end-to-end gain. Different CPUs, mitigations, socket layouts, filesystems and read sizes will move the bottleneck.

What operators should measure

There is nothing to enable on a production kernel today. The v2 posting is an RFC under review, is limited to 64-bit builds and excludes PREEMPT_RT. It includes a debugfs switch so testers can disable lockless page-cache reads without rebuilding, but the interface is explicitly not a stable ABI.[1]

Teams evaluating a future version should begin with workload shape, not a synthetic headline. The likely candidate has high system-call read rates, a very small shared hot set, many concurrent readers and weak scaling as threads cross cores or sockets. If a profiler shows storage latency, page faults, readahead misses, lock contention elsewhere or time in the application, this patch targets the wrong problem.

An A/B test should record operations per second and tail latency alongside CPU time, context switches, page-cache hit behavior, refaults, reclaim stalls and NUMA placement. Run long enough to include memory pressure and file rotation, not just a warm steady state. Test the real filesystem and mount options. The RFC's own ext4, XFS, tmpfs and block-device numbers differ because removing one bouncing counter can expose the next shared lock.

Before carrying an out-of-tree patch, test the obvious application-level alternative. A userspace cache or memory-mapped design may avoid repeated read() calls entirely. That can beat a faster kernel path, though it changes memory accounting, invalidation and application complexity. The RFC is most interesting where duplicating a shared data set in every worker is wasteful or where existing software cannot easily change its access model.

A good optimization because it knows its limits

The proposal turns a hot reference count into deferred reclamation. That is a sensible trade when thousands of readers repeatedly touch a stable folio and frees are rare. It is less attractive when memory churn is the workload.

The benchmark set does not hide that distinction. It contains spectacular microbenchmark gains, moderate RocksDB gains, unchanged mainstream tests and measurable regressions under pressure. That makes the work more credible, not less. The review question is whether the lifetime machinery is safe enough and the winning workloads common enough to justify another page flag, more reclaim accounting and changes to adjacent paths.

For infrastructure teams, the practical lesson is already useful: cached data can still have a coherence bottleneck. When a many-core read workload stops scaling even though its files are hot in RAM, the shared metadata protecting those pages deserves the same scrutiny as storage and application locks.

Sources

  1. RFC PATCH v2 00/18: mm: read the page cache without folio references — Kiryl Shutsemau / Linux kernel mailing lists, November 4, 2026.
  2. Memory Management APIs: file mapping and page cache — Linux kernel documentation.
  3. What is RCU? — Linux kernel documentation.
  4. The long path toward optimizing short reads — LWN.net, background on earlier short-read work.
  5. Linus Torvalds' AI-assisted page-cache experiment — Phoronix, independent coverage of the original RFC lineage.

QuantumBytz Team

The QuantumBytz Editorial Team covers cutting-edge computing infrastructure, including quantum computing, AI systems, Linux performance, HPC, and enterprise tooling. Our mission is to provide accurate, in-depth technical content for infrastructure professionals.

Learn more about our editorial team