2sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget*/translations/zh_CN/admin-guide/mm/pagemapmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/zh_TW/admin-guide/mm/pagemapmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/it_IT/admin-guide/mm/pagemapmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/ja_JP/admin-guide/mm/pagemapmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/ko_KR/admin-guide/mm/pagemapmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/sp_SP/admin-guide/mm/pagemapmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hExamining Process Page Tablesh]hExamining Process Page Tables}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhD/var/lib/git/docbuild/linux/Documentation/admin-guide/mm/pagemap.rsthKubh paragraph)}(hpagemap is a new (as of 2.6.25) set of interfaces in the kernel that allow userspace programs to examine the page tables and related information by reading files in ``/proc``.h](hpagemap is a new (as of 2.6.25) set of interfaces in the kernel that allow userspace programs to examine the page tables and related information by reading files in }(hhhhhNhNubhliteral)}(h ``/proc``h]h/proc}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhubh.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h%There are four components to pagemap:h]h%There are four components to pagemap:}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh block_quote)}(hX * ``/proc/pid/pagemap``. This file lets a userspace process find out which physical frame each virtual page is mapped to. It contains one 64-bit value for each virtual page, containing the following data (from ``fs/proc/task_mmu.c``, above pagemap_read): * Bits 0-54 page frame number (PFN) if present * Bits 0-4 swap type if swapped * Bits 5-54 swap offset if swapped * Bit 55 pte is soft-dirty (see Documentation/admin-guide/mm/soft-dirty.rst) * Bit 56 page exclusively mapped (since 4.2) * Bit 57 pte is uffd-wp write-protected (since 5.13) (see Documentation/admin-guide/mm/userfaultfd.rst) * Bit 58 pte is a guard region (since 6.15) (see madvise (2) man page) * Bits 59-60 zero * Bit 61 page is file-page or shared-anon (since 3.5) * Bit 62 page swapped * Bit 63 page present Since Linux 4.0 only users with the CAP_SYS_ADMIN capability can get PFNs. In 4.0 and 4.1 opens by unprivileged fail with -EPERM. Starting from 4.2 the PFN field is zeroed if the user does not have CAP_SYS_ADMIN. Reason: information about PFNs helps in exploiting Rowhammer vulnerability. If the page is not present but in swap, then the PFN contains an encoding of the swap file number and the page's offset into the swap. Unmapped pages return a null PFN. This allows determining precisely which pages are mapped (or in swap) and comparing mapped pages between processes. Traditionally, bit 56 indicates that a page is mapped exactly once and bit 56 is clear when a page is mapped multiple times, even when mapped in the same process multiple times. In some kernel configurations, the semantics for pages part of a larger allocation (e.g., THP) can differ: bit 56 is set if all pages part of the corresponding large allocation are *certainly* mapped in the same process, even if the page is mapped multiple times in that process. Bit 56 is clear when any page page of the larger allocation is *maybe* mapped in a different process. In some cases, a large allocation might be treated as "maybe mapped by multiple processes" even though this is no longer the case. Efficient users of this interface will use ``/proc/pid/maps`` to determine which areas of memory are actually mapped and llseek to skip over unmapped regions. * ``/proc/kpagecount``. This file contains a 64-bit count of the number of times each page is mapped, indexed by PFN. Some kernel configurations do not track the precise number of times a page part of a larger allocation (e.g., THP) is mapped. In these configurations, the average number of mappings per page in this larger allocation is returned instead. However, if any page of the large allocation is mapped, the returned value will be at least 1. h]h bullet_list)}(hhh](h list_item)}(hX``/proc/pid/pagemap``. This file lets a userspace process find out which physical frame each virtual page is mapped to. It contains one 64-bit value for each virtual page, containing the following data (from ``fs/proc/task_mmu.c``, above pagemap_read): * Bits 0-54 page frame number (PFN) if present * Bits 0-4 swap type if swapped * Bits 5-54 swap offset if swapped * Bit 55 pte is soft-dirty (see Documentation/admin-guide/mm/soft-dirty.rst) * Bit 56 page exclusively mapped (since 4.2) * Bit 57 pte is uffd-wp write-protected (since 5.13) (see Documentation/admin-guide/mm/userfaultfd.rst) * Bit 58 pte is a guard region (since 6.15) (see madvise (2) man page) * Bits 59-60 zero * Bit 61 page is file-page or shared-anon (since 3.5) * Bit 62 page swapped * Bit 63 page present Since Linux 4.0 only users with the CAP_SYS_ADMIN capability can get PFNs. In 4.0 and 4.1 opens by unprivileged fail with -EPERM. Starting from 4.2 the PFN field is zeroed if the user does not have CAP_SYS_ADMIN. Reason: information about PFNs helps in exploiting Rowhammer vulnerability. If the page is not present but in swap, then the PFN contains an encoding of the swap file number and the page's offset into the swap. Unmapped pages return a null PFN. This allows determining precisely which pages are mapped (or in swap) and comparing mapped pages between processes. Traditionally, bit 56 indicates that a page is mapped exactly once and bit 56 is clear when a page is mapped multiple times, even when mapped in the same process multiple times. In some kernel configurations, the semantics for pages part of a larger allocation (e.g., THP) can differ: bit 56 is set if all pages part of the corresponding large allocation are *certainly* mapped in the same process, even if the page is mapped multiple times in that process. Bit 56 is clear when any page page of the larger allocation is *maybe* mapped in a different process. In some cases, a large allocation might be treated as "maybe mapped by multiple processes" even though this is no longer the case. Efficient users of this interface will use ``/proc/pid/maps`` to determine which areas of memory are actually mapped and llseek to skip over unmapped regions. h](h)}(h``/proc/pid/pagemap``. This file lets a userspace process find out which physical frame each virtual page is mapped to. It contains one 64-bit value for each virtual page, containing the following data (from ``fs/proc/task_mmu.c``, above pagemap_read):h](h)}(h``/proc/pid/pagemap``h]h/proc/pid/pagemap}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhubh. This file lets a userspace process find out which physical frame each virtual page is mapped to. It contains one 64-bit value for each virtual page, containing the following data (from }(hhhhhNhNubh)}(h``fs/proc/task_mmu.c``h]hfs/proc/task_mmu.c}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhubh, above pagemap_read):}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hhubh)}(hX3* Bits 0-54 page frame number (PFN) if present * Bits 0-4 swap type if swapped * Bits 5-54 swap offset if swapped * Bit 55 pte is soft-dirty (see Documentation/admin-guide/mm/soft-dirty.rst) * Bit 56 page exclusively mapped (since 4.2) * Bit 57 pte is uffd-wp write-protected (since 5.13) (see Documentation/admin-guide/mm/userfaultfd.rst) * Bit 58 pte is a guard region (since 6.15) (see madvise (2) man page) * Bits 59-60 zero * Bit 61 page is file-page or shared-anon (since 3.5) * Bit 62 page swapped * Bit 63 page present h]h)}(hhh](h)}(h-Bits 0-54 page frame number (PFN) if presenth]h)}(hj1h]h-Bits 0-54 page frame number (PFN) if present}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj/ubah}(h]h ]h"]h$]h&]uh1hhj,ubh)}(hBits 0-4 swap type if swappedh]h)}(hjHh]hBits 0-4 swap type if swapped}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjFubah}(h]h ]h"]h$]h&]uh1hhj,ubh)}(h!Bits 5-54 swap offset if swappedh]h)}(hj_h]h!Bits 5-54 swap offset if swapped}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj]ubah}(h]h ]h"]h$]h&]uh1hhj,ubh)}(hNBit 55 pte is soft-dirty (see Documentation/admin-guide/mm/soft-dirty.rst)h]h)}(hNBit 55 pte is soft-dirty (see Documentation/admin-guide/mm/soft-dirty.rst)h]hNBit 55 pte is soft-dirty (see Documentation/admin-guide/mm/soft-dirty.rst)}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjtubah}(h]h ]h"]h$]h&]uh1hhj,ubh)}(h.Bit 56 page exclusively mapped (since 4.2)h]h)}(hjh]h.Bit 56 page exclusively mapped (since 4.2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj,ubh)}(hiBit 57 pte is uffd-wp write-protected (since 5.13) (see Documentation/admin-guide/mm/userfaultfd.rst)h]h)}(hiBit 57 pte is uffd-wp write-protected (since 5.13) (see Documentation/admin-guide/mm/userfaultfd.rst)h]hiBit 57 pte is uffd-wp write-protected (since 5.13) (see Documentation/admin-guide/mm/userfaultfd.rst)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj,ubh)}(hHBit 58 pte is a guard region (since 6.15) (see madvise (2) man page)h]h)}(hjh]hHBit 58 pte is a guard region (since 6.15) (see madvise (2) man page)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj,ubh)}(hBits 59-60 zeroh]h)}(hjh]hBits 59-60 zero}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj,ubh)}(h7Bit 61 page is file-page or shared-anon (since 3.5)h]h)}(hjh]h7Bit 61 page is file-page or shared-anon (since 3.5)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj,ubh)}(hBit 62 page swappedh]h)}(hjh]hBit 62 page swapped}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj,ubh)}(hBit 63 page present h]h)}(hBit 63 page presenth]hBit 63 page present}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj,ubeh}(h]h ]h"]h$]h&]bullet*uh1hhhhKhj(ubah}(h]h ]h"]h$]h&]uh1hhhhKhhubh)}(hX!Since Linux 4.0 only users with the CAP_SYS_ADMIN capability can get PFNs. In 4.0 and 4.1 opens by unprivileged fail with -EPERM. Starting from 4.2 the PFN field is zeroed if the user does not have CAP_SYS_ADMIN. Reason: information about PFNs helps in exploiting Rowhammer vulnerability.h]hX!Since Linux 4.0 only users with the CAP_SYS_ADMIN capability can get PFNs. In 4.0 and 4.1 opens by unprivileged fail with -EPERM. Starting from 4.2 the PFN field is zeroed if the user does not have CAP_SYS_ADMIN. Reason: information about PFNs helps in exploiting Rowhammer vulnerability.}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhubh)}(hXIf the page is not present but in swap, then the PFN contains an encoding of the swap file number and the page's offset into the swap. Unmapped pages return a null PFN. This allows determining precisely which pages are mapped (or in swap) and comparing mapped pages between processes.h]hXIf the page is not present but in swap, then the PFN contains an encoding of the swap file number and the page’s offset into the swap. Unmapped pages return a null PFN. This allows determining precisely which pages are mapped (or in swap) and comparing mapped pages between processes.}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hhubh)}(hXTraditionally, bit 56 indicates that a page is mapped exactly once and bit 56 is clear when a page is mapped multiple times, even when mapped in the same process multiple times. In some kernel configurations, the semantics for pages part of a larger allocation (e.g., THP) can differ: bit 56 is set if all pages part of the corresponding large allocation are *certainly* mapped in the same process, even if the page is mapped multiple times in that process. Bit 56 is clear when any page page of the larger allocation is *maybe* mapped in a different process. In some cases, a large allocation might be treated as "maybe mapped by multiple processes" even though this is no longer the case.h](hXgTraditionally, bit 56 indicates that a page is mapped exactly once and bit 56 is clear when a page is mapped multiple times, even when mapped in the same process multiple times. In some kernel configurations, the semantics for pages part of a larger allocation (e.g., THP) can differ: bit 56 is set if all pages part of the corresponding large allocation are }(hjYhhhNhNubhemphasis)}(h *certainly*h]h certainly}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1jahjYubh mapped in the same process, even if the page is mapped multiple times in that process. Bit 56 is clear when any page page of the larger allocation is }(hjYhhhNhNubjb)}(h*maybe*h]hmaybe}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjYubh mapped in a different process. In some cases, a large allocation might be treated as “maybe mapped by multiple processes” even though this is no longer the case.}(hjYhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK)hhubh)}(hEfficient users of this interface will use ``/proc/pid/maps`` to determine which areas of memory are actually mapped and llseek to skip over unmapped regions.h](h+Efficient users of this interface will use }(hjhhhNhNubh)}(h``/proc/pid/maps``h]h/proc/pid/maps}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubha to determine which areas of memory are actually mapped and llseek to skip over unmapped regions.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK4hhubeh}(h]h ]h"]h$]h&]uh1hhhubh)}(hX``/proc/kpagecount``. This file contains a 64-bit count of the number of times each page is mapped, indexed by PFN. Some kernel configurations do not track the precise number of times a page part of a larger allocation (e.g., THP) is mapped. In these configurations, the average number of mappings per page in this larger allocation is returned instead. However, if any page of the large allocation is mapped, the returned value will be at least 1. h]h)}(hX``/proc/kpagecount``. This file contains a 64-bit count of the number of times each page is mapped, indexed by PFN. Some kernel configurations do not track the precise number of times a page part of a larger allocation (e.g., THP) is mapped. In these configurations, the average number of mappings per page in this larger allocation is returned instead. However, if any page of the large allocation is mapped, the returned value will be at least 1.h](h)}(h``/proc/kpagecount``h]h/proc/kpagecount}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhX. This file contains a 64-bit count of the number of times each page is mapped, indexed by PFN. Some kernel configurations do not track the precise number of times a page part of a larger allocation (e.g., THP) is mapped. In these configurations, the average number of mappings per page in this larger allocation is returned instead. However, if any page of the large allocation is mapped, the returned value will be at least 1.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK8hjubah}(h]h ]h"]h$]h&]uh1hhhubeh}(h]h ]h"]h$]h&]j5j6uh1hhhhK hhubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hhThe page-types tool in the tools/mm directory can be used to query the number of times a page is mapped.h]hhThe page-types tool in the tools/mm directory can be used to query the number of times a page is mapped.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK@hhhhubh)}(hX* ``/proc/kpageflags``. This file contains a 64-bit set of flags for each page, indexed by PFN. The flags are (from ``fs/proc/page.c``, above kpageflags_read): 0. LOCKED 1. ERROR 2. REFERENCED 3. UPTODATE 4. DIRTY 5. LRU 6. ACTIVE 7. SLAB 8. WRITEBACK 9. RECLAIM 10. BUDDY 11. MMAP 12. ANON 13. SWAPCACHE 14. SWAPBACKED 15. COMPOUND_HEAD 16. COMPOUND_TAIL 17. HUGE 18. UNEVICTABLE 19. HWPOISON 20. NOPAGE 21. KSM 22. THP 23. OFFLINE 24. ZERO_PAGE 25. IDLE 26. PGTABLE * ``/proc/kpagecgroup``. This file contains a 64-bit inode number of the memory cgroup each page is charged to, indexed by PFN. Only available when CONFIG_MEMCG is set. h]h)}(hhh](h)}(hX``/proc/kpageflags``. This file contains a 64-bit set of flags for each page, indexed by PFN. The flags are (from ``fs/proc/page.c``, above kpageflags_read): 0. LOCKED 1. ERROR 2. REFERENCED 3. UPTODATE 4. DIRTY 5. LRU 6. ACTIVE 7. SLAB 8. WRITEBACK 9. RECLAIM 10. BUDDY 11. MMAP 12. ANON 13. SWAPCACHE 14. SWAPBACKED 15. COMPOUND_HEAD 16. COMPOUND_TAIL 17. HUGE 18. UNEVICTABLE 19. HWPOISON 20. NOPAGE 21. KSM 22. THP 23. OFFLINE 24. ZERO_PAGE 25. IDLE 26. PGTABLE h](h)}(h^``/proc/kpageflags``. This file contains a 64-bit set of flags for each page, indexed by PFN.h](h)}(h``/proc/kpageflags``h]h/proc/kpageflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhJ. This file contains a 64-bit set of flags for each page, indexed by PFN.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKChjubh)}(h?The flags are (from ``fs/proc/page.c``, above kpageflags_read):h](hThe flags are (from }(hjhhhNhNubh)}(h``fs/proc/page.c``h]hfs/proc/page.c}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh, above kpageflags_read):}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKFhjubh)}(hX40. LOCKED 1. ERROR 2. REFERENCED 3. UPTODATE 4. DIRTY 5. LRU 6. ACTIVE 7. SLAB 8. WRITEBACK 9. RECLAIM 10. BUDDY 11. MMAP 12. ANON 13. SWAPCACHE 14. SWAPBACKED 15. COMPOUND_HEAD 16. COMPOUND_TAIL 17. HUGE 18. UNEVICTABLE 19. HWPOISON 20. NOPAGE 21. KSM 22. THP 23. OFFLINE 24. ZERO_PAGE 25. IDLE 26. PGTABLE h]henumerated_list)}(hhh](h)}(hLOCKEDh]h)}(hjEh]hLOCKED}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKHhjCubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hERRORh]h)}(hj\h]hERROR}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKIhjZubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(h REFERENCEDh]h)}(hjsh]h REFERENCED}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKJhjqubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hUPTODATEh]h)}(hjh]hUPTODATE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKKhjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hDIRTYh]h)}(hjh]hDIRTY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKLhjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hLRUh]h)}(hjh]hLRU}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKMhjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hACTIVEh]h)}(hjh]hACTIVE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKNhjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hSLABh]h)}(hjh]hSLAB}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKOhjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(h WRITEBACKh]h)}(hjh]h WRITEBACK}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKPhjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hRECLAIMh]h)}(hjh]hRECLAIM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKQhjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hBUDDYh]h)}(hj+h]hBUDDY}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKRhj)ubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hMMAPh]h)}(hjBh]hMMAP}(hjDhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKShj@ubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hANONh]h)}(hjYh]hANON}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKThjWubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(h SWAPCACHEh]h)}(hjph]h SWAPCACHE}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKUhjnubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(h SWAPBACKEDh]h)}(hjh]h SWAPBACKED}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKVhjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(h COMPOUND_HEADh]h)}(hjh]h COMPOUND_HEAD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKWhjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(h COMPOUND_TAILh]h)}(hjh]h COMPOUND_TAIL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKXhjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hHUGEh]h)}(hjh]hHUGE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKYhjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(h UNEVICTABLEh]h)}(hjh]h UNEVICTABLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKZhjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hHWPOISONh]h)}(hjh]hHWPOISON}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK[hjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hNOPAGEh]h)}(hjh]hNOPAGE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK\hjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hKSMh]h)}(hj(h]hKSM}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK]hj&ubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hTHPh]h)}(hj?h]hTHP}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK^hj=ubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hOFFLINEh]h)}(hjVh]hOFFLINE}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK_hjTubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(h ZERO_PAGEh]h)}(hjmh]h ZERO_PAGE}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK`hjkubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hIDLEh]h)}(hjh]hIDLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKahjubah}(h]h ]h"]h$]h&]uh1hhj@ubh)}(hPGTABLE h]h)}(hPGTABLEh]hPGTABLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKbhjubah}(h]h ]h"]h$]h&]uh1hhj@ubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix.startKuh1j>hj:ubah}(h]h ]h"]h$]h&]uh1hhhhKHhjubeh}(h]h ]h"]h$]h&]uh1hhjubh)}(h``/proc/kpagecgroup``. This file contains a 64-bit inode number of the memory cgroup each page is charged to, indexed by PFN. Only available when CONFIG_MEMCG is set. h]h)}(h``/proc/kpagecgroup``. This file contains a 64-bit inode number of the memory cgroup each page is charged to, indexed by PFN. Only available when CONFIG_MEMCG is set.h](h)}(h``/proc/kpagecgroup``h]h/proc/kpagecgroup}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh. This file contains a 64-bit inode number of the memory cgroup each page is charged to, indexed by PFN. Only available when CONFIG_MEMCG is set.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKdhjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]j5j6uh1hhhhKChjubah}(h]h ]h"]h$]h&]uh1hhhhKChhhhubh)}(hhh](h)}(h$Short descriptions to the page flagsh]h$Short descriptions to the page flags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKiubhdefinition_list)}(hhh](hdefinition_list_item)}(h[0 - LOCKED The page is being locked for exclusive access, e.g. by undergoing read/write IO.h](hterm)}(h 0 - LOCKEDh]h 0 - LOCKED}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKlhjubh definition)}(hhh]h)}(hPThe page is being locked for exclusive access, e.g. by undergoing read/write IO.h]hPThe page is being locked for exclusive access, e.g. by undergoing read/write IO.}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKlhj)ubah}(h]h ]h"]h$]h&]uh1j'hjubeh}(h]h ]h"]h$]h&]uh1jhhhKlhjubj)}(h7 - SLAB The page is managed by the SLAB/SLUB kernel memory allocator. When compound page is used, either will only set this flag on the head page.h](j)}(h7 - SLABh]h7 - SLAB}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKphjFubj()}(hhh]h)}(hThe page is managed by the SLAB/SLUB kernel memory allocator. When compound page is used, either will only set this flag on the head page.h]hThe page is managed by the SLAB/SLUB kernel memory allocator. When compound page is used, either will only set this flag on the head page.}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKohjXubah}(h]h ]h"]h$]h&]uh1j'hjFubeh}(h]h ]h"]h$]h&]uh1jhhhKphjhhubj)}(h10 - BUDDY A free memory block managed by the buddy system allocator. The buddy system organizes free memory in blocks of various orders. An order N block has 2^N physically contiguous pages, with the BUDDY flag set for and _only_ for the first page.h](j)}(h 10 - BUDDYh]h 10 - BUDDY}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKuhjuubj()}(hhh]h)}(hA free memory block managed by the buddy system allocator. The buddy system organizes free memory in blocks of various orders. An order N block has 2^N physically contiguous pages, with the BUDDY flag set for and _only_ for the first page.h]hA free memory block managed by the buddy system allocator. The buddy system organizes free memory in blocks of various orders. An order N block has 2^N physically contiguous pages, with the BUDDY flag set for and _only_ for the first page.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKshjubah}(h]h ]h"]h$]h&]uh1j'hjuubeh}(h]h ]h"]h$]h&]uh1jhhhKuhjhhubj)}(hX15 - COMPOUND_HEAD A compound page with order N consists of 2^N physically contiguous pages. A compound page with order 2 takes the form of "HTTT", where H donates its head page and T donates its tail page(s). The major consumers of compound pages are hugeTLB pages (Documentation/admin-guide/mm/hugetlbpage.rst), the SLUB etc. memory allocators and various device drivers. However in this interface, only huge/giga pages are made visible to end users.h](j)}(h15 - COMPOUND_HEADh]h15 - COMPOUND_HEAD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhK}hjubj()}(hhh]h)}(hXA compound page with order N consists of 2^N physically contiguous pages. A compound page with order 2 takes the form of "HTTT", where H donates its head page and T donates its tail page(s). The major consumers of compound pages are hugeTLB pages (Documentation/admin-guide/mm/hugetlbpage.rst), the SLUB etc. memory allocators and various device drivers. However in this interface, only huge/giga pages are made visible to end users.h]hXA compound page with order N consists of 2^N physically contiguous pages. A compound page with order 2 takes the form of “HTTT”, where H donates its head page and T donates its tail page(s). The major consumers of compound pages are hugeTLB pages (Documentation/admin-guide/mm/hugetlbpage.rst), the SLUB etc. memory allocators and various device drivers. However in this interface, only huge/giga pages are made visible to end users.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKxhjubah}(h]h ]h"]h$]h&]uh1j'hjubeh}(h]h ]h"]h$]h&]uh1jhhhK}hjhhubj)}(h@16 - COMPOUND_TAIL A compound page tail (see description above).h](j)}(h16 - COMPOUND_TAILh]h16 - COMPOUND_TAIL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj()}(hhh]h)}(h-A compound page tail (see description above).h]h-A compound page tail (see description above).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j'hjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj)}(h517 - HUGE This is an integral part of a HugeTLB page.h](j)}(h 17 - HUGEh]h 17 - HUGE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj()}(hhh]h)}(h+This is an integral part of a HugeTLB page.h]h+This is an integral part of a HugeTLB page.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j'hjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj)}(hU19 - HWPOISON Hardware detected memory corruption on this page: don't touch the data!h](j)}(h 19 - HWPOISONh]h 19 - HWPOISON}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj1ubj()}(hhh]h)}(hGHardware detected memory corruption on this page: don't touch the data!h]hIHardware detected memory corruption on this page: don’t touch the data!}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjCubah}(h]h ]h"]h$]h&]uh1j'hj1ubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj)}(h:20 - NOPAGE No page frame exists at the requested address.h](j)}(h 20 - NOPAGEh]h 20 - NOPAGE}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj`ubj()}(hhh]h)}(h.No page frame exists at the requested address.h]h.No page frame exists at the requested address.}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjrubah}(h]h ]h"]h$]h&]uh1j'hj`ubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj)}(hQ21 - KSM Identical memory pages dynamically shared between one or more processes.h](j)}(h21 - KSMh]h21 - KSM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj()}(hhh]h)}(hHIdentical memory pages dynamically shared between one or more processes.h]hHIdentical memory pages dynamically shared between one or more processes.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j'hjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj)}(hX22 - THP Contiguous pages which construct THP of any size and mapped by any granularity.h](j)}(h22 - THPh]h22 - THP}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj()}(hhh]h)}(hOContiguous pages which construct THP of any size and mapped by any granularity.h]hOContiguous pages which construct THP of any size and mapped by any granularity.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j'hjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj)}(h+23 - OFFLINE The page is logically offline.h](j)}(h 23 - OFFLINEh]h 23 - OFFLINE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj()}(hhh]h)}(hThe page is logically offline.h]hThe page is logically offline.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j'hjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj)}(h824 - ZERO_PAGE Zero page for pfn_zero or huge_zero page.h](j)}(h24 - ZERO_PAGEh]h24 - ZERO_PAGE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj()}(hhh]h)}(h)Zero page for pfn_zero or huge_zero page.h]h)Zero page for pfn_zero or huge_zero page.}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj.ubah}(h]h ]h"]h$]h&]uh1j'hjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj)}(hX%25 - IDLE The page has not been accessed since it was marked idle (see Documentation/admin-guide/mm/idle_page_tracking.rst). Note that this flag may be stale in case the page was accessed via a PTE. To make sure the flag is up-to-date one has to read ``/sys/kernel/mm/page_idle/bitmap`` first.h](j)}(h 25 - IDLEh]h 25 - IDLE}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjKubj()}(hhh]h)}(hXThe page has not been accessed since it was marked idle (see Documentation/admin-guide/mm/idle_page_tracking.rst). Note that this flag may be stale in case the page was accessed via a PTE. To make sure the flag is up-to-date one has to read ``/sys/kernel/mm/page_idle/bitmap`` first.h](hThe page has not been accessed since it was marked idle (see Documentation/admin-guide/mm/idle_page_tracking.rst). Note that this flag may be stale in case the page was accessed via a PTE. To make sure the flag is up-to-date one has to read }(hj`hhhNhNubh)}(h#``/sys/kernel/mm/page_idle/bitmap``h]h/sys/kernel/mm/page_idle/bitmap}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj`ubh first.}(hj`hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj]ubah}(h]h ]h"]h$]h&]uh1j'hjKubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj)}(h126 - PGTABLE The page is in use as a page table. h](j)}(h 26 - PGTABLEh]h 26 - PGTABLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj()}(hhh]h)}(h#The page is in use as a page table.h]h#The page is in use as a page table.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j'hjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubeh}(h]h ]h"]h$]h&]uh1j hjhhhhhNubh)}(hhh](h)}(hIO related page flagsh]hIO related page flags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubj )}(hhh](j)}(h1 - ERROR IO error occurred.h](j)}(h 1 - ERRORh]h 1 - ERROR}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj()}(hhh]h)}(hIO error occurred.h]hIO error occurred.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j'hjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjubj)}(hm3 - UPTODATE The page has up-to-date data. ie. for file backed page: (in-memory data revision >= on-disk one)h](j)}(h 3 - UPTODATEh]h 3 - UPTODATE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj ubj()}(hhh]h)}(h`The page has up-to-date data. ie. for file backed page: (in-memory data revision >= on-disk one)h]h`The page has up-to-date data. ie. for file backed page: (in-memory data revision >= on-disk one)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j'hj ubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj)}(h4 - DIRTY The page has been written to, hence contains new data. i.e. for file backed page: (in-memory data revision > on-disk one)h](j)}(h 4 - DIRTYh]h 4 - DIRTY}(hj7 hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj3 ubj()}(hhh]h)}(hzThe page has been written to, hence contains new data. i.e. for file backed page: (in-memory data revision > on-disk one)h]hzThe page has been written to, hence contains new data. i.e. for file backed page: (in-memory data revision > on-disk one)}(hjH hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjE ubah}(h]h ]h"]h$]h&]uh1j'hj3 ubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj)}(h08 - WRITEBACK The page is being synced to disk. h](j)}(h 8 - WRITEBACKh]h 8 - WRITEBACK}(hjf hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjb ubj()}(hhh]h)}(h!The page is being synced to disk.h]h!The page is being synced to disk.}(hjw hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjt ubah}(h]h ]h"]h$]h&]uh1j'hjb ubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubeh}(h]h ]h"]h$]h&]uh1j hjhhhhhNubeh}(h]io-related-page-flagsah ]h"]io related page flagsah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(hLRU related page flagsh]hLRU related page flags}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubj )}(hhh](j)}(h,5 - LRU The page is in one of the LRU lists.h](j)}(h5 - LRUh]h5 - LRU}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj ubj()}(hhh]h)}(h$The page is in one of the LRU lists.h]h$The page is in one of the LRU lists.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j'hj ubeh}(h]h ]h"]h$]h&]uh1jhhhKhj ubj)}(h.6 - ACTIVE The page is in the active LRU list.h](j)}(h 6 - ACTIVEh]h 6 - ACTIVE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj ubj()}(hhh]h)}(h#The page is in the active LRU list.h]h#The page is in the active LRU list.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j'hj ubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubj)}(h18 - UNEVICTABLE The page is in the unevictable (non-)LRU list It is somehow pinned and not a candidate for LRU page reclaims, e.g. ramfs pages, shmctl(SHM_LOCK) and mlock() memory segments.h](j)}(h18 - UNEVICTABLEh]h18 - UNEVICTABLE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj ubj()}(hhh]h)}(hThe page is in the unevictable (non-)LRU list It is somehow pinned and not a candidate for LRU page reclaims, e.g. ramfs pages, shmctl(SHM_LOCK) and mlock() memory segments.h]hThe page is in the unevictable (non-)LRU list It is somehow pinned and not a candidate for LRU page reclaims, e.g. ramfs pages, shmctl(SHM_LOCK) and mlock() memory segments.}(hj& hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj# ubah}(h]h ]h"]h$]h&]uh1j'hj ubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubj)}(hP2 - REFERENCED The page has been referenced since last LRU list enqueue/requeue.h](j)}(h2 - REFERENCEDh]h2 - REFERENCED}(hjD hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj@ ubj()}(hhh]h)}(hAThe page has been referenced since last LRU list enqueue/requeue.h]hAThe page has been referenced since last LRU list enqueue/requeue.}(hjU hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjR ubah}(h]h ]h"]h$]h&]uh1j'hj@ ubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubj)}(hK9 - RECLAIM The page will be reclaimed soon after its pageout IO completed.h](j)}(h 9 - RECLAIMh]h 9 - RECLAIM}(hjs hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjo ubj()}(hhh]h)}(h?The page will be reclaimed soon after its pageout IO completed.h]h?The page will be reclaimed soon after its pageout IO completed.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j'hjo ubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubj)}(h11 - MMAP A memory mapped page.h](j)}(h 11 - MMAPh]h 11 - MMAP}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj ubj()}(hhh]h)}(hA memory mapped page.h]hA memory mapped page.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j'hj ubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubj)}(h:12 - ANON A memory mapped page that is not part of a file.h](j)}(h 12 - ANONh]h 12 - ANON}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj ubj()}(hhh]h)}(h0A memory mapped page that is not part of a file.h]h0A memory mapped page that is not part of a file.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j'hj ubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubj)}(hS13 - SWAPCACHE The page is mapped to swap space, i.e. has an associated swap entry.h](j)}(h13 - SWAPCACHEh]h13 - SWAPCACHE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj ubj()}(hhh]h)}(hDThe page is mapped to swap space, i.e. has an associated swap entry.h]hDThe page is mapped to swap space, i.e. has an associated swap entry.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j'hj ubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubj)}(h014 - SWAPBACKED The page is backed by swap/RAM. h](j)}(h14 - SWAPBACKEDh]h14 - SWAPBACKED}(hj/ hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj+ ubj()}(hhh]h)}(hThe page is backed by swap/RAM.h]hThe page is backed by swap/RAM.}(hj@ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj= ubah}(h]h ]h"]h$]h&]uh1j'hj+ ubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubeh}(h]h ]h"]h$]h&]uh1j hj hhhhhNubh)}(hSThe page-types tool in the tools/mm directory can be used to query the above flags.h]hSThe page-types tool in the tools/mm directory can be used to query the above flags.}(hj` hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubeh}(h]lru-related-page-flagsah ]h"]lru related page flagsah$]h&]uh1hhjhhhhhKubeh}(h]$short-descriptions-to-the-page-flagsah ]h"]$short descriptions to the page flagsah$]h&]uh1hhhhhhhhKiubh)}(hhh](h)}(hExceptions for Shared Memoryh]hExceptions for Shared Memory}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj~ hhhhhKubh)}(hPage table entries for shared pages are cleared when the pages are zapped or swapped out. This makes swapped out pages indistinguishable from never-allocated ones.h]hPage table entries for shared pages are cleared when the pages are zapped or swapped out. This makes swapped out pages indistinguishable from never-allocated ones.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj~ hhubh)}(hIn kernel space, the swap location can still be retrieved from the page cache. However, values stored only on the normal PTE get lost irretrievably when the page is swapped out (i.e. SOFT_DIRTY).h]hIn kernel space, the swap location can still be retrieved from the page cache. However, values stored only on the normal PTE get lost irretrievably when the page is swapped out (i.e. SOFT_DIRTY).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj~ hhubh)}(h~In user space, whether the page is present, swapped or none can be deduced with the help of lseek and/or mincore system calls.h]h~In user space, whether the page is present, swapped or none can be deduced with the help of lseek and/or mincore system calls.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj~ hhubh)}(hXlseek() can differentiate between accessed pages (present or swapped out) and holes (none/non-allocated) by specifying the SEEK_DATA flag on the file where the pages are backed. For anonymous shared pages, the file can be found in ``/proc/pid/map_files/``.h](hlseek() can differentiate between accessed pages (present or swapped out) and holes (none/non-allocated) by specifying the SEEK_DATA flag on the file where the pages are backed. For anonymous shared pages, the file can be found in }(hj hhhNhNubh)}(h``/proc/pid/map_files/``h]h/proc/pid/map_files/}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj~ hhubh)}(hmincore() can differentiate between pages in memory (present, including swap cache) and out of memory (swapped out or none/non-allocated).h]hmincore() can differentiate between pages in memory (present, including swap cache) and out of memory (swapped out or none/non-allocated).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj~ hhubeh}(h]exceptions-for-shared-memoryah ]h"]exceptions for shared memoryah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Other notesh]h Other notes}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(hReading from any of the files will return -EINVAL if you are not starting the read on an 8-byte boundary (e.g., if you sought an odd number of bytes into the file), or if the size of the read is not a multiple of 8 bytes.h]hReading from any of the files will return -EINVAL if you are not starting the read on an 8-byte boundary (e.g., if you sought an odd number of bytes into the file), or if the size of the read is not a multiple of 8 bytes.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hBefore Linux 3.11 pagemap bits 55-60 were used for "page-shift" (which is always 12 at most architectures). Since Linux 3.11 their meaning changes after first clear of soft-dirty bits. Since Linux 4.2 they are used for flags unconditionally.h]hBefore Linux 3.11 pagemap bits 55-60 were used for “page-shift” (which is always 12 at most architectures). Since Linux 3.11 their meaning changes after first clear of soft-dirty bits. Since Linux 4.2 they are used for flags unconditionally.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubeh}(h] other-notesah ]h"] other notesah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hPagemap Scan IOCTLh]hPagemap Scan IOCTL}(hj' hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj$ hhhhhKubh)}(hThe ``PAGEMAP_SCAN`` IOCTL on the pagemap file can be used to get or optionally clear the info about page table entries. The following operations are supported in this IOCTL:h](hThe }(hj5 hhhNhNubh)}(h``PAGEMAP_SCAN``h]h PAGEMAP_SCAN}(hj= hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj5 ubh IOCTL on the pagemap file can be used to get or optionally clear the info about page table entries. The following operations are supported in this IOCTL:}(hj5 hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj$ hhubh)}(hhh](h)}(hScan the address range and get the memory ranges matching the provided criteria. This is performed when the output buffer is specified.h]h)}(hScan the address range and get the memory ranges matching the provided criteria. This is performed when the output buffer is specified.h]hScan the address range and get the memory ranges matching the provided criteria. This is performed when the output buffer is specified.}(hj\ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjX ubah}(h]h ]h"]h$]h&]uh1hhjU hhhhhNubh)}(hXWrite-protect the pages. The ``PM_SCAN_WP_MATCHING`` is used to write-protect the pages of interest. The ``PM_SCAN_CHECK_WPASYNC`` aborts the operation if non-Async Write Protected pages are found. The ``PM_SCAN_WP_MATCHING`` can be used with or without ``PM_SCAN_CHECK_WPASYNC``.h]h)}(hXWrite-protect the pages. The ``PM_SCAN_WP_MATCHING`` is used to write-protect the pages of interest. The ``PM_SCAN_CHECK_WPASYNC`` aborts the operation if non-Async Write Protected pages are found. The ``PM_SCAN_WP_MATCHING`` can be used with or without ``PM_SCAN_CHECK_WPASYNC``.h](hWrite-protect the pages. The }(hjt hhhNhNubh)}(h``PM_SCAN_WP_MATCHING``h]hPM_SCAN_WP_MATCHING}(hj| hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjt ubh5 is used to write-protect the pages of interest. The }(hjt hhhNhNubh)}(h``PM_SCAN_CHECK_WPASYNC``h]hPM_SCAN_CHECK_WPASYNC}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjt ubhH aborts the operation if non-Async Write Protected pages are found. The }(hjt hhhNhNubh)}(h``PM_SCAN_WP_MATCHING``h]hPM_SCAN_WP_MATCHING}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjt ubh can be used with or without }(hjt hhhNhNubh)}(h``PM_SCAN_CHECK_WPASYNC``h]hPM_SCAN_CHECK_WPASYNC}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjt ubh.}(hjt hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjp ubah}(h]h ]h"]h$]h&]uh1hhjU hhhhhNubh)}(hyBoth of those operations can be combined into one atomic operation where we can get and write protect the pages as well. h]h)}(hxBoth of those operations can be combined into one atomic operation where we can get and write protect the pages as well.h]hxBoth of those operations can be combined into one atomic operation where we can get and write protect the pages as well.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1hhjU hhhhhNubeh}(h]h ]h"]h$]h&]j5-uh1hhhhKhj$ hhubh)}(h4Following flags about pages are currently supported:h]h4Following flags about pages are currently supported:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj$ hhubh)}(hhh](h)}(h?``PAGE_IS_WPALLOWED`` - Page has async-write-protection enabledh]h)}(hj h](h)}(h``PAGE_IS_WPALLOWED``h]hPAGE_IS_WPALLOWED}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh* - Page has async-write-protection enabled}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1hhj hhhhhNubh)}(hS``PAGE_IS_WRITTEN`` - Page has been written to from the time it was write protectedh]h)}(hj' h](h)}(h``PAGE_IS_WRITTEN``h]hPAGE_IS_WRITTEN}(hj, hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj) ubh@ - Page has been written to from the time it was write protected}(hj) hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj% ubah}(h]h ]h"]h$]h&]uh1hhj hhhhhNubh)}(h&``PAGE_IS_FILE`` - Page is file backedh]h)}(hjL h](h)}(h``PAGE_IS_FILE``h]h PAGE_IS_FILE}(hjQ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjN ubh - Page is file backed}(hjN hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjJ ubah}(h]h ]h"]h$]h&]uh1hhj hhhhhNubh)}(h3``PAGE_IS_PRESENT`` - Page is present in the memoryh]h)}(hjq h](h)}(h``PAGE_IS_PRESENT``h]hPAGE_IS_PRESENT}(hjv hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjs ubh - Page is present in the memory}(hjs hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjo ubah}(h]h ]h"]h$]h&]uh1hhj hhhhhNubh)}(h(``PAGE_IS_SWAPPED`` - Page is in swappedh]h)}(hj h](h)}(h``PAGE_IS_SWAPPED``h]hPAGE_IS_SWAPPED}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh - Page is in swapped}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1hhj hhhhhNubh)}(h'``PAGE_IS_PFNZERO`` - Page has zero PFNh]h)}(hj h](h)}(h``PAGE_IS_PFNZERO``h]hPAGE_IS_PFNZERO}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh - Page has zero PFN}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1hhj hhhhhNubh)}(h;``PAGE_IS_HUGE`` - Page is PMD-mapped THP or Hugetlb backedh]h)}(hj h](h)}(h``PAGE_IS_HUGE``h]h PAGE_IS_HUGE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh+ - Page is PMD-mapped THP or Hugetlb backed}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1hhj hhhhhNubh)}(h,``PAGE_IS_SOFT_DIRTY`` - Page is soft-dirty h]h)}(h+``PAGE_IS_SOFT_DIRTY`` - Page is soft-dirtyh](h)}(h``PAGE_IS_SOFT_DIRTY``h]hPAGE_IS_SOFT_DIRTY}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh - Page is soft-dirty}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj hhhhhNubeh}(h]h ]h"]h$]h&]j5j uh1hhhhKhj$ hhubh)}(h@The ``struct pm_scan_arg`` is used as the argument of the IOCTL.h](hThe }(hj/hhhNhNubh)}(h``struct pm_scan_arg``h]hstruct pm_scan_arg}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj/ubh& is used as the argument of the IOCTL.}(hj/hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj$ hhubh)}(hX1. The size of the ``struct pm_scan_arg`` must be specified in the ``size`` field. This field will be helpful in recognizing the structure if extensions are done later. 2. The flags can be specified in the ``flags`` field. The ``PM_SCAN_WP_MATCHING`` and ``PM_SCAN_CHECK_WPASYNC`` are the only added flags at this time. The get operation is optionally performed depending upon if the output buffer is provided or not. 3. The range is specified through ``start`` and ``end``. 4. The walk can abort before visiting the complete range such as the user buffer can get full etc. The walk ending address is specified in``end_walk``. 5. The output buffer of ``struct page_region`` array and size is specified in ``vec`` and ``vec_len``. 6. The optional maximum requested pages are specified in the ``max_pages``. 7. The masks are specified in ``category_mask``, ``category_anyof_mask``, ``category_inverted`` and ``return_mask``. h]j?)}(hhh](h)}(hThe size of the ``struct pm_scan_arg`` must be specified in the ``size`` field. This field will be helpful in recognizing the structure if extensions are done later.h]h)}(hThe size of the ``struct pm_scan_arg`` must be specified in the ``size`` field. This field will be helpful in recognizing the structure if extensions are done later.h](hThe size of the }(hjZhhhNhNubh)}(h``struct pm_scan_arg``h]hstruct pm_scan_arg}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjZubh must be specified in the }(hjZhhhNhNubh)}(h``size``h]hsize}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1hhjZubh] field. This field will be helpful in recognizing the structure if extensions are done later.}(hjZhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjVubah}(h]h ]h"]h$]h&]uh1hhjSubh)}(hThe flags can be specified in the ``flags`` field. The ``PM_SCAN_WP_MATCHING`` and ``PM_SCAN_CHECK_WPASYNC`` are the only added flags at this time. The get operation is optionally performed depending upon if the output buffer is provided or not.h]h)}(hThe flags can be specified in the ``flags`` field. The ``PM_SCAN_WP_MATCHING`` and ``PM_SCAN_CHECK_WPASYNC`` are the only added flags at this time. The get operation is optionally performed depending upon if the output buffer is provided or not.h](h"The flags can be specified in the }(hjhhhNhNubh)}(h ``flags``h]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh field. The }(hjhhhNhNubh)}(h``PM_SCAN_WP_MATCHING``h]hPM_SCAN_WP_MATCHING}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh and }(hjhhhNhNubh)}(h``PM_SCAN_CHECK_WPASYNC``h]hPM_SCAN_CHECK_WPASYNC}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh are the only added flags at this time. The get operation is optionally performed depending upon if the output buffer is provided or not.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjSubh)}(h5The range is specified through ``start`` and ``end``.h]h)}(hjh](hThe range is specified through }(hjhhhNhNubh)}(h ``start``h]hstart}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh and }(hjhhhNhNubh)}(h``end``h]hend}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjSubh)}(hThe walk can abort before visiting the complete range such as the user buffer can get full etc. The walk ending address is specified in``end_walk``.h]h)}(hThe walk can abort before visiting the complete range such as the user buffer can get full etc. The walk ending address is specified in``end_walk``.h]hThe walk can abort before visiting the complete range such as the user buffer can get full etc. The walk ending address is specified in``end_walk``.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjSubh)}(hcThe output buffer of ``struct page_region`` array and size is specified in ``vec`` and ``vec_len``.h]h)}(hcThe output buffer of ``struct page_region`` array and size is specified in ``vec`` and ``vec_len``.h](hThe output buffer of }(hj7hhhNhNubh)}(h``struct page_region``h]hstruct page_region}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7ubh array and size is specified in }(hj7hhhNhNubh)}(h``vec``h]hvec}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7ubh and }(hj7hhhNhNubh)}(h ``vec_len``h]hvec_len}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7ubh.}(hj7hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hj3ubah}(h]h ]h"]h$]h&]uh1hhjSubh)}(hHThe optional maximum requested pages are specified in the ``max_pages``.h]h)}(hjh](h:The optional maximum requested pages are specified in the }(hjhhhNhNubh)}(h ``max_pages``h]h max_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hjubah}(h]h ]h"]h$]h&]uh1hhjSubh)}(hrThe masks are specified in ``category_mask``, ``category_anyof_mask``, ``category_inverted`` and ``return_mask``. h]h)}(hqThe masks are specified in ``category_mask``, ``category_anyof_mask``, ``category_inverted`` and ``return_mask``.h](hThe masks are specified in }(hjhhhNhNubh)}(h``category_mask``h]h category_mask}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh, }(hjhhhNhNubh)}(h``category_anyof_mask``h]hcategory_anyof_mask}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh, }(hjhhhNhNubh)}(h``category_inverted``h]hcategory_inverted}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh and }(hjhhhNhNubh)}(h``return_mask``h]h return_mask}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hjubah}(h]h ]h"]h$]h&]uh1hhjSubeh}(h]h ]h"]h$]h&]jjjhjjuh1j>hjOubah}(h]h ]h"]h$]h&]uh1hhhhMhj$ hhubh)}(h8Find pages which have been written and WP them as well::h]h7Find pages which have been written and WP them as well:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj$ hhubh literal_block)}(hstruct pm_scan_arg arg = { .size = sizeof(arg), .flags = PM_SCAN_CHECK_WPASYNC | PM_SCAN_CHECK_WPASYNC, .. .category_mask = PAGE_IS_WRITTEN, .return_mask = PAGE_IS_WRITTEN, };h]hstruct pm_scan_arg arg = { .size = sizeof(arg), .flags = PM_SCAN_CHECK_WPASYNC | PM_SCAN_CHECK_WPASYNC, .. .category_mask = PAGE_IS_WRITTEN, .return_mask = PAGE_IS_WRITTEN, };}hj&sbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1j$hhhMhj$ hhubh)}(h]Find pages which have been written, are file backed, not swapped and either present or huge::h]h\Find pages which have been written, are file backed, not swapped and either present or huge:}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj$ hhubj%)}(hX4struct pm_scan_arg arg = { .size = sizeof(arg), .flags = 0, .. .category_mask = PAGE_IS_WRITTEN | PAGE_IS_SWAPPED, .category_inverted = PAGE_IS_SWAPPED, .category_anyof_mask = PAGE_IS_PRESENT | PAGE_IS_HUGE, .return_mask = PAGE_IS_WRITTEN | PAGE_IS_SWAPPED | PAGE_IS_PRESENT | PAGE_IS_HUGE, };h]hX4struct pm_scan_arg arg = { .size = sizeof(arg), .flags = 0, .. .category_mask = PAGE_IS_WRITTEN | PAGE_IS_SWAPPED, .category_inverted = PAGE_IS_SWAPPED, .category_anyof_mask = PAGE_IS_PRESENT | PAGE_IS_HUGE, .return_mask = PAGE_IS_WRITTEN | PAGE_IS_SWAPPED | PAGE_IS_PRESENT | PAGE_IS_HUGE, };}hjDsbah}(h]h ]h"]h$]h&]j4j5uh1j$hhhMhj$ hhubh)}(hX3The ``PAGE_IS_WRITTEN`` flag can be considered as a better-performing alternative of soft-dirty flag. It doesn't get affected by VMA merging of the kernel and hence the user can find the true soft-dirty pages in case of normal pages. (There may still be extra dirty pages reported for THP or Hugetlb pages.)h](hThe }(hjRhhhNhNubh)}(h``PAGE_IS_WRITTEN``h]hPAGE_IS_WRITTEN}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjRubhX flag can be considered as a better-performing alternative of soft-dirty flag. It doesn’t get affected by VMA merging of the kernel and hence the user can find the true soft-dirty pages in case of normal pages. (There may still be extra dirty pages reported for THP or Hugetlb pages.)}(hjRhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM(hj$ hhubh)}(hz"PAGE_IS_WRITTEN" category is used with uffd write protect-enabled ranges to implement memory dirty tracking in userspace:h]h~“PAGE_IS_WRITTEN” category is used with uffd write protect-enabled ranges to implement memory dirty tracking in userspace:A}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM-hj$ hhubh)}(hX1. The userfaultfd file descriptor is created with ``userfaultfd`` syscall. 2. The ``UFFD_FEATURE_WP_UNPOPULATED`` and ``UFFD_FEATURE_WP_ASYNC`` features are set by ``UFFDIO_API`` IOCTL. 3. The memory range is registered with ``UFFDIO_REGISTER_MODE_WP`` mode through ``UFFDIO_REGISTER`` IOCTL. 4. Then any part of the registered memory or the whole memory region must be write protected using ``PAGEMAP_SCAN`` IOCTL with flag ``PM_SCAN_WP_MATCHING`` or the ``UFFDIO_WRITEPROTECT`` IOCTL can be used. Both of these perform the same operation. The former is better in terms of performance. 5. Now the ``PAGEMAP_SCAN`` IOCTL can be used to either just find pages which have been written to since they were last marked and/or optionally write protect the pages as well.h]j?)}(hhh](h)}(hHThe userfaultfd file descriptor is created with ``userfaultfd`` syscall.h]h)}(hjh](h0The userfaultfd file descriptor is created with }(hjhhhNhNubh)}(h``userfaultfd``h]h userfaultfd}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh syscall.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM0hjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hkThe ``UFFD_FEATURE_WP_UNPOPULATED`` and ``UFFD_FEATURE_WP_ASYNC`` features are set by ``UFFDIO_API`` IOCTL.h]h)}(hkThe ``UFFD_FEATURE_WP_UNPOPULATED`` and ``UFFD_FEATURE_WP_ASYNC`` features are set by ``UFFDIO_API`` IOCTL.h](hThe }(hjhhhNhNubh)}(h``UFFD_FEATURE_WP_UNPOPULATED``h]hUFFD_FEATURE_WP_UNPOPULATED}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh and }(hjhhhNhNubh)}(h``UFFD_FEATURE_WP_ASYNC``h]hUFFD_FEATURE_WP_ASYNC}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh features are set by }(hjhhhNhNubh)}(h``UFFDIO_API``h]h UFFDIO_API}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh IOCTL.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM1hjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hgThe memory range is registered with ``UFFDIO_REGISTER_MODE_WP`` mode through ``UFFDIO_REGISTER`` IOCTL.h]h)}(hgThe memory range is registered with ``UFFDIO_REGISTER_MODE_WP`` mode through ``UFFDIO_REGISTER`` IOCTL.h](h$The memory range is registered with }(hjhhhNhNubh)}(h``UFFDIO_REGISTER_MODE_WP``h]hUFFDIO_REGISTER_MODE_WP}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh mode through }(hjhhhNhNubh)}(h``UFFDIO_REGISTER``h]hUFFDIO_REGISTER}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh IOCTL.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM3hjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hX"Then any part of the registered memory or the whole memory region must be write protected using ``PAGEMAP_SCAN`` IOCTL with flag ``PM_SCAN_WP_MATCHING`` or the ``UFFDIO_WRITEPROTECT`` IOCTL can be used. Both of these perform the same operation. The former is better in terms of performance.h]h)}(hX"Then any part of the registered memory or the whole memory region must be write protected using ``PAGEMAP_SCAN`` IOCTL with flag ``PM_SCAN_WP_MATCHING`` or the ``UFFDIO_WRITEPROTECT`` IOCTL can be used. Both of these perform the same operation. The former is better in terms of performance.h](h`Then any part of the registered memory or the whole memory region must be write protected using }(hj>hhhNhNubh)}(h``PAGEMAP_SCAN``h]h PAGEMAP_SCAN}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj>ubh IOCTL with flag }(hj>hhhNhNubh)}(h``PM_SCAN_WP_MATCHING``h]hPM_SCAN_WP_MATCHING}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj>ubh or the }(hj>hhhNhNubh)}(h``UFFDIO_WRITEPROTECT``h]hUFFDIO_WRITEPROTECT}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj>ubhk IOCTL can be used. Both of these perform the same operation. The former is better in terms of performance.}(hj>hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM5hj:ubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hNow the ``PAGEMAP_SCAN`` IOCTL can be used to either just find pages which have been written to since they were last marked and/or optionally write protect the pages as well.h]h)}(hNow the ``PAGEMAP_SCAN`` IOCTL can be used to either just find pages which have been written to since they were last marked and/or optionally write protect the pages as well.h](hNow the }(hjhhhNhNubh)}(h``PAGEMAP_SCAN``h]h PAGEMAP_SCAN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh IOCTL can be used to either just find pages which have been written to since they were last marked and/or optionally write protect the pages as well.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM9hjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]jjjhjjuh1j>hjubah}(h]h ]h"]h$]h&]uh1hhhhM0hj$ hhubeh}(h]pagemap-scan-ioctlah ]h"]pagemap scan ioctlah$]h&]uh1hhhhhhhhKubeh}(h]examining-process-page-tablesah ]h"]examining process page tablesah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjj{ jx j j js jp j j j! j jju nametypes}(jj{ j js j j! juh}(jhjx jj jjp j j j~ j j jj$ u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]hsystem_message)}(hhh]h)}(h:Enumerated list start value not ordinal-1: "0" (ordinal 0)h]h>Enumerated list start value not ordinal-1: “0” (ordinal 0)}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjUubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1jShj:ubatransform_messages] transformerN include_log] decorationNhhub.