{
  "slug": "madv-populate-write",
  "term": "MADV_POPULATE_WRITE",
  "aliases": [
    "madvise write population"
  ],
  "definition": "MADV_POPULATE_WRITE is a Linux operation that prefaults an existing virtual-memory range for write access and reports population errors.",
  "note": "Available since Linux 5.14, this operation requires writable mappings and can target a subrange. Failure can leave part of the range populated; success is not an all-or-nothing transaction. [populate-api]\n\nWrite preparation: the Linux v6.14 path requests write faults and dirty marking. Private file mappings can resolve copy-on-write before later stores; shared mappings can enter filesystem write-fault handling. Allocation depends on mapping and backing storage, so this is not a general file-space reservation operation. [populate-gup] [populate-fault]\n\nBoundary: WRITE prepares access without storing an application payload. It neither freezes a consistent file version nor synchronizes a durable update. It does not itself establish a memory lock; residency requires a separate locking contract. [populate-gup] [populate-lock]",
  "advantages": [
    "Moves some private-copy preparation ahead of later application stores."
  ],
  "limitations": [
    "Does not prevent later truncation or other concurrent changes to the backing object.",
    "May incur allocation, I/O and memory-pressure costs."
  ],
  "related": [
    "madv-populate-read",
    "mlock",
    "memory-mapped-file"
  ],
  "citations": [
    {
      "id": "populate-api",
      "title": "Linux man-pages: madvise(2), explicit read/write population and errors",
      "url": "https://man7.org/linux/man-pages/man2/madvise.2.html",
      "accessed": "2026-12-01"
    },
    {
      "id": "populate-gup",
      "title": "Linux v6.14: faultin_page_range, access flags and dirty marking",
      "url": "https://raw.githubusercontent.com/torvalds/linux/v6.14/mm/gup.c",
      "accessed": "2026-12-01"
    },
    {
      "id": "populate-fault",
      "title": "Linux v6.14: do_fault, private COW and shared write-fault paths",
      "url": "https://raw.githubusercontent.com/torvalds/linux/v6.14/mm/memory.c",
      "accessed": "2026-12-01"
    },
    {
      "id": "populate-lock",
      "title": "Linux man-pages: mlock(2), residency guarantees and lock lifetime",
      "url": "https://man7.org/linux/man-pages/man2/mlock.2.html",
      "accessed": "2026-12-01"
    }
  ],
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-12-01",
  "provenance": [
    "API documentation and Linux v6.14 source review; implementation scope is distinct from the recorded host kernel.",
    "A separate 24-observation Linux probe checks access permissions and partial population beyond EOF, not latency, allocation, memory pressure or durability: https://hesela.dev/research/madv-populate/README.md."
  ]
}
