Linux RFC lets hot page-cache reads skip folio refcounts
Meta reworks a Linus Torvalds idea so multi-CPU small reads stop bouncing the same folio's reference count.
Small parallel reads of one file from many CPUs today all take and drop a reference on the same folio, so its refcount cache line bounces between cores. An RFC series from Meta's Kiryl Shutsemau, reworking an earlier proposal by Linus Torvalds, lets filemap and shmem copy from the page cache without taking that reference.
The design adds a PG_rcu_free flag used only on hot folios: ones that folio_mark_accessed() already treats as fully warm, or that a single open file keeps re-reading. A flagged folio is freed only after an RCU grace period, so a lockless reader that saw the flag can finish copying safely. Streaming and cold data are left alone, which keeps the deferred memory small.
filemap_read() and the shmem path gain a fast path that copies under RCU when the folio is hot, uptodate, and not otherwise special. Large folios are handled with one extra lookup so a whole range can be copied after a single check. Supporting work counts deferred pages, runs an expedited grace period when a CPU's pending frees grow large or a zone is under pressure, drains them before reclaim gives up or contiguous allocation and memory offline fail, and makes memory failure wait out lockless readers before unmapping a poisoned page. Inode eviction clears the flag at once, since no lockless reader can still hold the file open.
On a 64-vCPU KVM guest, Shutsemau reports large multi-thread gains for repeated 16-byte preads at the same offset. With default mitigations the user/kernel boundary still dominates a single thread; with mitigations off the 64-thread improvement is much larger, matching the scale Torvalds saw on similar hardware. The series is RFC-only and includes a debugfs switch to disable the lockless path.