{
  "slug": "page-cache",
  "term": "Page cache",
  "aliases": [
    "Linux page cache"
  ],
  "definition": "The page cache is the kernel-managed memory that holds cached file contents for access and writeback.",
  "note": "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. [iomap]\n\nLinux 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. [vm-sysctl]\n\nThe 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. [vm-sysctl]\n\nIn 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. [pagemap-src] [bdi-src] [readahead-src]",
  "advantages": [
    {
      "text": "Can serve reusable file contents from memory.",
      "citationIds": [
        "iomap"
      ]
    },
    {
      "text": "Clean cached pages are reclaimed automatically under memory pressure, without manual tuning.",
      "citationIds": [
        "vm-sysctl"
      ]
    }
  ],
  "limitations": [
    {
      "text": "A cached copy is not an independent backup or proof of durable storage.",
      "citationIds": [
        "iomap"
      ]
    },
    {
      "text": "Rebuilding dropped cache objects can incur extra I/O and CPU work; clearing caches changes the initial state of a benchmark.",
      "citationIds": [
        "vm-sysctl"
      ]
    }
  ],
  "related": [
    "buffered-io",
    "direct-io",
    "write-back-cache",
    "writeback-error",
    "posix-fadv-noreuse",
    "posix-fadv-dontneed",
    "rwf-dontcache",
    "memory-mapped-file",
    "rwf-nowait",
    "posix-fadv-willneed",
    "readahead",
    "mincore",
    "process-io-accounting",
    "fuse-writeback-cache",
    "fastmap",
    "working-set",
    "locality-of-reference",
    "cachestat",
    "cache-ext",
    "programmable-page-cache",
    "tmpfs",
    "dirty-page-throttling",
    "geiger",
    "streamcache"
  ],
  "citations": [
    {
      "id": "iomap",
      "label": "Linux v6.17 iomap",
      "title": "Linux v6.17: iomap supported file operations, sections 2.2.1-2.2.3.",
      "url": "https://www.kernel.org/doc/html/v6.17/filesystems/iomap/operations.html",
      "accessed": "2026-10-14"
    },
    {
      "id": "vm-sysctl",
      "title": "Linux v6.16 documentation: Documentation for /proc/sys/vm/",
      "url": "https://www.kernel.org/doc/html/v6.16/admin-guide/sysctl/vm.html",
      "accessed": "2026-10-22"
    },
    {
      "id": "pagemap-src",
      "title": "Linux v6.16 include/linux/pagemap.h: VM_READAHEAD_PAGES",
      "url": "https://github.com/torvalds/linux/blob/v6.16/include/linux/pagemap.h",
      "accessed": "2026-12-04"
    },
    {
      "id": "bdi-src",
      "title": "Linux v6.16 mm/backing-dev.c: bdi_alloc and read_ahead_kb_store.",
      "url": "https://github.com/torvalds/linux/blob/v6.16/mm/backing-dev.c",
      "accessed": "2026-12-04"
    },
    {
      "id": "readahead-src",
      "title": "Linux v6.16 mm/readahead.c: file_ra_state_init and adaptive window selection.",
      "url": "https://github.com/torvalds/linux/blob/v6.16/mm/readahead.c",
      "accessed": "2026-12-04"
    }
  ],
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-12-04",
  "provenance": [
    "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."
  ]
}
