Page cache
The page cache is the kernel-managed memory that holds cached file contents for access and writeback.
Linux iomap manages cached folios and their up-to-date and dirty state. Its direct-I/O path still flushes dirty cached data and invalidates cached ranges where required, so bypassing cached transfers does not eliminate coherence work. [1]
Linux exposes a drop_caches control in the vm sysctl directory. Writing 1 frees clean page cache, 2 frees reclaimable slab objects such as dentries and inodes, and 3 frees both, while 4 (bit 2) silences the log message. Dirty objects are never freed, so flushing beforehand increases what can be dropped. [2]
The control does not limit cache growth, because cached objects are reclaimed automatically when memory is needed elsewhere. Rebuilding dropped objects can cost significant I/O and CPU, so its use outside testing or debugging is not recommended. [2]
In Linux v6.16, VM_READAHEAD_PAGES supplies a 128 KiB initialization default for backing-device readahead state, not a fixed window for every read. The read_ahead_kb setting can change that budget; newly opened files copy it into per-open state, and the automatic readahead algorithm adjusts its window using access history. [3] [4] [5]
Relations
- related
- Buffered I/O, Direct I/O, Write-back cache, Writeback error, POSIX_FADV_NOREUSE, POSIX_FADV_DONTNEED, RWF_DONTCACHE, Memory-mapped file, RWF_NOWAIT, POSIX_FADV_WILLNEED, readahead (Linux syscall), mincore, Process I/O accounting, FUSE writeback-cache, FastMap, Working set, Locality of reference, cachestat, cache_ext, Programmable Page Cache (PPC), tmpfs, Dirty-page throttling, Geiger, StreamCache
Advantages
- Can serve reusable file contents from memory. [1]
- Clean cached pages are reclaimed automatically under memory pressure, without manual tuning. [2]
Limitations
- A cached copy is not an independent backup or proof of durable storage. [1]
- Rebuilding dropped cache objects can incur extra I/O and CPU work; clearing caches changes the initial state of a benchmark. [2]
Citations
- Linux v6.17: iomap supported file operations, sections 2.2.1-2.2.3.
- Linux v6.16 documentation: Documentation for /proc/sys/vm/
- Linux v6.16 include/linux/pagemap.h: VM_READAHEAD_PAGES
- Linux v6.16 mm/backing-dev.c: bdi_alloc and read_ahead_kb_store.
- Linux v6.16 mm/readahead.c: file_ra_state_init and adaptive window selection.
Sources & caveats
- iomap is the Linux v6.17 iomap operations page, kept from the earlier version.
- vm-sysctl is the Linux v6.16 sysctl vm documentation, read in the drop_caches section on the access date.
- pagemap-src is include/linux/pagemap.h at tag v6.16, read for VM_READAHEAD_PAGES = SZ_128K / PAGE_SIZE.
- 1, 2, 3 and 4 (bit 2) come from vm-sysctl. 128 KiB comes from pagemap-src.
- 2026-12-04: corrected the fixed-window implication by tracing the v6.16 initialization, mutable backing-device budget and per-open adaptive state. Source review only.