proc_pid_pagemap(5)

๐Ÿ’– proc_pid_pagemap โ€” bestie edition ๐Ÿ’–

okay so this is a page from the File Formats Manual section, and honestly? it's giving "the kernel is showing u its diary but it's all in binary". it's proc_pid_pagemap, and we're gonna get through it together, no cap. ๐Ÿซถ


โœจ NAME โœจ

/proc/pid/pagemap โ€” the map of ur virtual pages, literally


๐ŸŒธ DESCRIPTION ๐ŸŒธ

/proc/pid/pagemap (since Linux 2.6.25)

okay so this file is the moment. it shows the mapping of each of the process's virtual pages into physical page frames or swap area. she's thorough. ๐Ÿ’…

it contains one 64-bit value for every single virtual page, and the bits are set like this:

  • bit 63 โ€” if set, the page is present in RAM. ๐Ÿ 
  • bit 62 โ€” if set, the page is in swap space. ๐ŸŒ€
  • bit 61 (since Linux 3.5) โ€” the page is a file-mapped page or a shared anonymous page.
  • bits 60โ€“58 (since Linux 3.11) โ€” zero. that's it. just zero. icons of doing nothing โœจ.
  • bit 57 (since Linux 5.14) โ€” if set, the page is write-protected through userfaultfd(2).
  • bit 56 (since Linux 4.2) โ€” the page is exclusively mapped.
  • bit 55 (since Linux 3.11) โ€” PTE is soft-dirty (see the kernel source file Documentation/admin-guide/mm/soft-dirty.rst).
  • bits 54โ€“0 โ€” if the page is present in RAM (bit 63), then these bits provide the page frame number, which u can use to index /proc/kpageflags and /proc/kpagecount. if the page is present in swap (bit 62), then bits 4โ€“0 give the swap type, and bits 54โ€“5 encode the swap offset. two completely different jobs, same lil bit range, she contains multitudes ๐Ÿ’€.
before Linux 3.11, bits 60โ€“55 were used to encode the base-2 log of the page size. so like. old news but worth knowing, bestie.

the way that u should stay efficient here: to employ /proc/pid/pagemap efficiently, use /proc/pid/maps to figure out which areas of memory are actually mapped, then seek to skip over the unmapped regions. don't read the whole thing like a fool, skip past the empty parts, main character energy only ๐Ÿ‘‘.

also important: the /proc/pid/pagemap file is present only if the CONFIG_PROC_PAGE_MONITOR kernel configuration option is enabled. no config, no file, no vibes. ๐Ÿ˜ญ

and permission to access this file is governed by a ptrace access mode PTRACE_MODE_READ_FSCREDS check; see ptrace(2).


๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹


and that's the whole page babes!! this was from Linux man-pages 6.20, dated 2026-02-08, in the proc_pid_pagemap(5) era of the internet. go forth and read ur bits responsibly. periodt ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹๐ŸŒธ

๐Ÿ“ฆ where this page comes from
  • arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • ๐Ÿ“œ the page's license: GPL-3.0-or-later
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms