sphinx.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]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/pt_BR/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 tracked by userfaultfd (since 5.13) — in a ``VM_UFFD_WP`` VMA this indicates a write-protected PTE; in a ``VM_UFFD_RWP`` VMA it indicates an RWP-protected PTE. WP and RWP are mutually exclusive per VMA, so the meaning is unambiguous. 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 tracked by userfaultfd (since 5.13) — in a ``VM_UFFD_WP`` VMA this indicates a write-protected PTE; in a ``VM_UFFD_RWP`` VMA it indicates an RWP-protected PTE. WP and RWP are mutually exclusive per VMA, so the meaning is unambiguous. 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}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh. 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 }(hjhhhNhNubh)}(h``fs/proc/task_mmu.c``h]hfs/proc/task_mmu.c}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh, above pagemap_read):}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hj ubh)}(hX* 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 tracked by userfaultfd (since 5.13) — in a ``VM_UFFD_WP`` VMA this indicates a write-protected PTE; in a ``VM_UFFD_RWP`` VMA it indicates an RWP-protected PTE. WP and RWP are mutually exclusive per VMA, so the meaning is unambiguous. 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]j)}(hhh](j )}(h-Bits 0-54 page frame number (PFN) if presenth]h)}(hjEh]h-Bits 0-54 page frame number (PFN) if present}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjCubah}(h]h ]h"]h$]h&]uh1jhj@ubj )}(hBits 0-4 swap type if swappedh]h)}(hj\h]hBits 0-4 swap type if swapped}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjZubah}(h]h ]h"]h$]h&]uh1jhj@ubj )}(h!Bits 5-54 swap offset if swappedh]h)}(hjsh]h!Bits 5-54 swap offset if swapped}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjqubah}(h]h ]h"]h$]h&]uh1jhj@ubj )}(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)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhj@ubj )}(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&]uh1jhj@ubj )}(hX/Bit 57 pte is tracked by userfaultfd (since 5.13) — in a ``VM_UFFD_WP`` VMA this indicates a write-protected PTE; in a ``VM_UFFD_RWP`` VMA it indicates an RWP-protected PTE. WP and RWP are mutually exclusive per VMA, so the meaning is unambiguous. See Documentation/admin-guide/mm/userfaultfd.rst.h]h)}(hX/Bit 57 pte is tracked by userfaultfd (since 5.13) — in a ``VM_UFFD_WP`` VMA this indicates a write-protected PTE; in a ``VM_UFFD_RWP`` VMA it indicates an RWP-protected PTE. WP and RWP are mutually exclusive per VMA, so the meaning is unambiguous. See Documentation/admin-guide/mm/userfaultfd.rst.h](h?Bit 57 pte is tracked by userfaultfd (since 5.13) — in a }(hjhhhNhNubh)}(h``VM_UFFD_WP``h]h VM_UFFD_WP}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh0 VMA this indicates a write-protected PTE; in a }(hjhhhNhNubh)}(h``VM_UFFD_RWP``h]h VM_UFFD_RWP}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh VMA it indicates an RWP-protected PTE. WP and RWP are mutually exclusive per VMA, so the meaning is unambiguous. See Documentation/admin-guide/mm/userfaultfd.rst.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhj@ubj )}(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&]uh1jhj@ubj )}(hBits 59-60 zeroh]h)}(hj h]hBits 59-60 zero}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj@ubj )}(h7Bit 61 page is file-page or shared-anon (since 3.5)h]h)}(hj#h]h7Bit 61 page is file-page or shared-anon (since 3.5)}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj!ubah}(h]h ]h"]h$]h&]uh1jhj@ubj )}(hBit 62 page swappedh]h)}(hj:h]hBit 62 page swapped}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj8ubah}(h]h ]h"]h$]h&]uh1jhj@ubj )}(hBit 63 page present h]h)}(hBit 63 page presenth]hBit 63 page present}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjOubah}(h]h ]h"]h$]h&]uh1jhj@ubeh}(h]h ]h"]h$]h&]bullet*uh1jhhhKhj<ubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubh)}(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.}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK!hj ubh)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK&hj ubh)}(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 }(hjhhhNhNubhemphasis)}(h *certainly*h]h certainly}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh 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 }(hjhhhNhNubj)}(h*maybe*h]hmaybe}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh 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.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK,hj ubh)}(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&]uh1hhhhK7hj ubeh}(h]h ]h"]h$]h&]uh1jhjubj )}(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&]uh1hhhhK;hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]jmjnuh1jhhhK 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&]uh1hhhhKChhhhubh)}(hX* ``/proc/kpageflags``. This file contains a 64-bit set of flags for each page, indexed by PFN. The flags are (from ``include/uapi/linux/kernel-page-flags.h``): 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]j)}(hhh](j )}(hX``/proc/kpageflags``. This file contains a 64-bit set of flags for each page, indexed by PFN. The flags are (from ``include/uapi/linux/kernel-page-flags.h``): 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}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj6ubhJ. This file contains a 64-bit set of flags for each page, indexed by PFN.}(hj6hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKFhj2ubh)}(h@The flags are (from ``include/uapi/linux/kernel-page-flags.h``):h](hThe flags are (from }(hjRhhhNhNubh)}(h*``include/uapi/linux/kernel-page-flags.h``h]h&include/uapi/linux/kernel-page-flags.h}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjRubh):}(hjRhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKIhj2ubh)}(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](j )}(hLOCKEDh]h)}(hj}h]hLOCKED}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKKhj{ubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hERRORh]h)}(hjh]hERROR}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKLhjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(h REFERENCEDh]h)}(hjh]h REFERENCED}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKMhjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hUPTODATEh]h)}(hjh]hUPTODATE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKNhjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hDIRTYh]h)}(hjh]hDIRTY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKOhjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hLRUh]h)}(hjh]hLRU}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKPhjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hACTIVEh]h)}(hjh]hACTIVE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKQhjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hSLABh]h)}(hjh]hSLAB}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKRhjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(h WRITEBACKh]h)}(hj5h]h WRITEBACK}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKShj3ubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hRECLAIMh]h)}(hjLh]hRECLAIM}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKThjJubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hBUDDYh]h)}(hjch]hBUDDY}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKUhjaubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hMMAPh]h)}(hjzh]hMMAP}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKVhjxubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hANONh]h)}(hjh]hANON}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKWhjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(h SWAPCACHEh]h)}(hjh]h SWAPCACHE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKXhjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(h SWAPBACKEDh]h)}(hjh]h SWAPBACKED}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKYhjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(h COMPOUND_HEADh]h)}(hjh]h COMPOUND_HEAD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKZhjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(h COMPOUND_TAILh]h)}(hjh]h COMPOUND_TAIL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK[hjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hHUGEh]h)}(hjh]hHUGE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK\hjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(h UNEVICTABLEh]h)}(hjh]h UNEVICTABLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK]hjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hHWPOISONh]h)}(hj2h]hHWPOISON}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK^hj0ubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hNOPAGEh]h)}(hjIh]hNOPAGE}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK_hjGubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hKSMh]h)}(hj`h]hKSM}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK`hj^ubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hTHPh]h)}(hjwh]hTHP}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKahjuubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hOFFLINEh]h)}(hjh]hOFFLINE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKbhjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(h ZERO_PAGEh]h)}(hjh]h ZERO_PAGE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKchjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hIDLEh]h)}(hjh]hIDLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKdhjubah}(h]h ]h"]h$]h&]uh1jhjxubj )}(hPGTABLE h]h)}(hPGTABLEh]hPGTABLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKehjubah}(h]h ]h"]h$]h&]uh1jhjxubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix.startKuh1jvhjrubah}(h]h ]h"]h$]h&]uh1hhhhKKhj2ubeh}(h]h ]h"]h$]h&]uh1jhj/ubj )}(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}(hj hhhNhNubah}(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&]uh1hhhhKghjubah}(h]h ]h"]h$]h&]uh1jhj/ubeh}(h]h ]h"]h$]h&]jmjnuh1jhhhKFhj+ubah}(h]h ]h"]h$]h&]uh1hhhhKFhhhhubh)}(hhh](h)}(h$Short descriptions to the page flagsh]h$Short descriptions to the page flags}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj3hhhhhKlubhdefinition_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}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKohjKubh 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.}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKohjaubah}(h]h ]h"]h$]h&]uh1j_hjKubeh}(h]h ]h"]h$]h&]uh1jIhhhKohjFubjJ)}(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](jP)}(h7 - SLABh]h7 - SLAB}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKshj~ubj`)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKrhjubah}(h]h ]h"]h$]h&]uh1j_hj~ubeh}(h]h ]h"]h$]h&]uh1jIhhhKshjFhhubjJ)}(hX$10 - 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 all pages. Before 4.6 only the first page of the block had the flag set.h](jP)}(h 10 - BUDDYh]h 10 - BUDDY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKyhjubj`)}(hhh]h)}(hXA 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 all pages. Before 4.6 only the first page of the block had the flag set.h]hXA 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 all pages. Before 4.6 only the first page of the block had the flag set.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKvhjubah}(h]h ]h"]h$]h&]uh1j_hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKyhjFhhubjJ)}(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](jP)}(h15 - COMPOUND_HEADh]h15 - COMPOUND_HEAD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhjubj`)}(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&]uh1hhhhK|hjubah}(h]h ]h"]h$]h&]uh1j_hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjFhhubjJ)}(h@16 - COMPOUND_TAIL A compound page tail (see description above).h](jP)}(h16 - COMPOUND_TAILh]h16 - COMPOUND_TAIL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhj ubj`)}(hhh]h)}(h-A compound page tail (see description above).h]h-A compound page tail (see description above).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j_hj ubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjFhhubjJ)}(h517 - HUGE This is an integral part of a HugeTLB page.h](jP)}(h 17 - HUGEh]h 17 - HUGE}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhj:ubj`)}(hhh]h)}(h+This is an integral part of a HugeTLB page.h]h+This is an integral part of a HugeTLB page.}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjLubah}(h]h ]h"]h$]h&]uh1j_hj:ubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjFhhubjJ)}(hU19 - HWPOISON Hardware detected memory corruption on this page: don't touch the data!h](jP)}(h 19 - HWPOISONh]h 19 - HWPOISON}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhjiubj`)}(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!}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj{ubah}(h]h ]h"]h$]h&]uh1j_hjiubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjFhhubjJ)}(h:20 - NOPAGE No page frame exists at the requested address.h](jP)}(h 20 - NOPAGEh]h 20 - NOPAGE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhjubj`)}(hhh]h)}(h.No page frame exists at the requested address.h]h.No page frame exists at the requested address.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j_hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjFhhubjJ)}(hQ21 - KSM Identical memory pages dynamically shared between one or more processes.h](jP)}(h21 - KSMh]h21 - KSM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhjubj`)}(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&]uh1jIhhhKhjFhhubjJ)}(hX22 - THP Contiguous pages which construct THP of any size and mapped by any granularity.h](jP)}(h22 - THPh]h22 - THP}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhjubj`)}(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.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j_hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjFhhubjJ)}(h+23 - OFFLINE The page is logically offline.h](jP)}(h 23 - OFFLINEh]h 23 - OFFLINE}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhj%ubj`)}(hhh]h)}(hThe page is logically offline.h]hThe page is logically offline.}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj7ubah}(h]h ]h"]h$]h&]uh1j_hj%ubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjFhhubjJ)}(h824 - ZERO_PAGE Zero page for pfn_zero or huge_zero page.h](jP)}(h24 - ZERO_PAGEh]h24 - ZERO_PAGE}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhjTubj`)}(hhh]h)}(h)Zero page for pfn_zero or huge_zero page.h]h)Zero page for pfn_zero or huge_zero page.}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjfubah}(h]h ]h"]h$]h&]uh1j_hjTubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjFhhubjJ)}(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](jP)}(h 25 - IDLEh]h 25 - IDLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhjubj`)}(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 }(hjhhhNhNubh)}(h#``/sys/kernel/mm/page_idle/bitmap``h]h/sys/kernel/mm/page_idle/bitmap}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh first.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j_hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjFhhubjJ)}(h126 - PGTABLE The page is in use as a page table. h](jP)}(h 26 - PGTABLEh]h 26 - PGTABLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhjubj`)}(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&]uh1jIhhhKhjFhhubeh}(h]h ]h"]h$]h&]uh1jDhj3hhhhhNubh)}(hhh](h)}(hIO related page flagsh]hIO related page flags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubjE)}(hhh](jJ)}(h1 - ERROR IO error occurred.h](jP)}(h 1 - ERRORh]h 1 - ERROR}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhj ubj`)}(hhh]h)}(hIO error occurred.h]hIO error occurred.}(hj" hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j_hj ubeh}(h]h ]h"]h$]h&]uh1jIhhhKhj ubjJ)}(hm3 - UPTODATE The page has up-to-date data. ie. for file backed page: (in-memory data revision >= on-disk one)h](jP)}(h 3 - UPTODATEh]h 3 - UPTODATE}(hj@ hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhj< 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)}(hjQ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjN ubah}(h]h ]h"]h$]h&]uh1j_hj< ubeh}(h]h ]h"]h$]h&]uh1jIhhhKhj hhubjJ)}(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](jP)}(h 4 - DIRTYh]h 4 - DIRTY}(hjo hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhjk 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)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj} ubah}(h]h ]h"]h$]h&]uh1j_hjk ubeh}(h]h ]h"]h$]h&]uh1jIhhhKhj hhubjJ)}(h08 - WRITEBACK The page is being synced to disk. h](jP)}(h 8 - WRITEBACKh]h 8 - WRITEBACK}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhj ubj`)}(hhh]h)}(h!The page is being synced to disk.h]h!The page is being synced to disk.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j_hj ubeh}(h]h ]h"]h$]h&]uh1jIhhhKhj hhubeh}(h]h ]h"]h$]h&]uh1jDhjhhhhhNubeh}(h]io-related-page-flagsah ]h"]io related page flagsah$]h&]uh1hhj3hhhhhKubh)}(hhh](h)}(hLRU related page flagsh]hLRU related page flags}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubjE)}(hhh](jJ)}(h,5 - LRU The page is in one of the LRU lists.h](jP)}(h5 - LRUh]h5 - LRU}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhj 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&]uh1jIhhhKhj ubjJ)}(h.6 - ACTIVE The page is in the active LRU list.h](jP)}(h 6 - ACTIVEh]h 6 - ACTIVE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhj 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&]uh1jIhhhKhj hhubjJ)}(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](jP)}(h18 - UNEVICTABLEh]h18 - UNEVICTABLE}(hjM hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhjI 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_hjI ubeh}(h]h ]h"]h$]h&]uh1jIhhhKhj hhubjJ)}(hP2 - REFERENCED The page has been referenced since last LRU list enqueue/requeue.h](jP)}(h2 - REFERENCEDh]h2 - REFERENCED}(hj| hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhjx 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.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j_hjx ubeh}(h]h ]h"]h$]h&]uh1jIhhhKhj hhubjJ)}(hK9 - RECLAIM The page will be reclaimed soon after its pageout IO completed.h](jP)}(h 9 - RECLAIMh]h 9 - RECLAIM}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhj 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_hj ubeh}(h]h ]h"]h$]h&]uh1jIhhhKhj hhubjJ)}(h11 - MMAP A memory mapped page.h](jP)}(h 11 - MMAPh]h 11 - MMAP}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhj 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&]uh1jIhhhKhj hhubjJ)}(h:12 - ANON A memory mapped page that is not part of a file.h](jP)}(h 12 - ANONh]h 12 - ANON}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhj 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&]uh1jIhhhKhj hhubjJ)}(hS13 - SWAPCACHE The page is mapped to swap space, i.e. has an associated swap entry.h](jP)}(h13 - SWAPCACHEh]h13 - SWAPCACHE}(hj8 hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhj4 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.}(hjI hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjF ubah}(h]h ]h"]h$]h&]uh1j_hj4 ubeh}(h]h ]h"]h$]h&]uh1jIhhhKhj hhubjJ)}(h014 - SWAPBACKED The page is backed by swap/RAM. h](jP)}(h14 - SWAPBACKEDh]h14 - SWAPBACKED}(hjg hhhNhNubah}(h]h ]h"]h$]h&]uh1jOhhhKhjc ubj`)}(hhh]h)}(hThe page is backed by swap/RAM.h]hThe page is backed by swap/RAM.}(hjx hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhju ubah}(h]h ]h"]h$]h&]uh1j_hjc ubeh}(h]h ]h"]h$]h&]uh1jIhhhKhj hhubeh}(h]h ]h"]h$]h&]uh1jDhj 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&]uh1hhj3hhhhhKubeh}(h]$short-descriptions-to-the-page-flagsah ]h"]$short descriptions to the page flagsah$]h&]uh1hhhhhhhhKlubh)}(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.}(hj8 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.}(hjF 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 }(hjm hhhNhNubh)}(h``PAGEMAP_SCAN``h]h PAGEMAP_SCAN}(hju hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjm 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:}(hjm hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj\ hhubj)}(hhh](j )}(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&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj hhhhhNubj )}(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 }(hj hhhNhNubh)}(h``PM_SCAN_WP_MATCHING``h]hPM_SCAN_WP_MATCHING}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh5 is used to write-protect the pages of interest. The }(hj hhhNhNubh)}(h``PM_SCAN_CHECK_WPASYNC``h]hPM_SCAN_CHECK_WPASYNC}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubhH aborts the operation if non-Async Write Protected pages are found. The }(hj hhhNhNubh)}(h``PM_SCAN_WP_MATCHING``h]hPM_SCAN_WP_MATCHING}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh can be used with or without }(hj hhhNhNubh)}(h``PM_SCAN_CHECK_WPASYNC``h]hPM_SCAN_CHECK_WPASYNC}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj hhhhhNubj )}(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&]uh1jhj hhhhhNubeh}(h]h ]h"]h$]h&]jm-uh1jhhhKhj\ hhubh)}(h4Following flags about pages are currently supported:h]h4Following flags about pages are currently supported:}(hj' hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj\ hhubj)}(hhh](j )}(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&]uh1hhhhKhj8 ubah}(h]h ]h"]h$]h&]uh1jhj5 hhhhhNubj )}(h``PAGE_IS_WRITTEN`` - Page in a ``UFFDIO_REGISTER_MODE_WP`` VMA has been written to since it was write-protected. Only reported inside such VMAs.h]h)}(h``PAGE_IS_WRITTEN`` - Page in a ``UFFDIO_REGISTER_MODE_WP`` VMA has been written to since it was write-protected. Only reported inside such VMAs.h](h)}(h``PAGE_IS_WRITTEN``h]hPAGE_IS_WRITTEN}(hje hhhNhNubah}(h]h ]h"]h$]h&]uh1hhja ubh - Page in a }(hja hhhNhNubh)}(h``UFFDIO_REGISTER_MODE_WP``h]hUFFDIO_REGISTER_MODE_WP}(hjw hhhNhNubah}(h]h ]h"]h$]h&]uh1hhja ubhV VMA has been written to since it was write-protected. Only reported inside such VMAs.}(hja hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj] ubah}(h]h ]h"]h$]h&]uh1jhj5 hhhhhNubj )}(h&``PAGE_IS_FILE`` - Page is file backedh]h)}(hj h](h)}(h``PAGE_IS_FILE``h]h PAGE_IS_FILE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh - Page is file backed}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj5 hhhhhNubj )}(h3``PAGE_IS_PRESENT`` - Page is present in the memoryh]h)}(hj h](h)}(h``PAGE_IS_PRESENT``h]hPAGE_IS_PRESENT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh - Page is present in the memory}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj5 hhhhhNubj )}(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&]uh1jhj5 hhhhhNubj )}(h'``PAGE_IS_PFNZERO`` - Page has zero PFNh]h)}(hjh](h)}(h``PAGE_IS_PFNZERO``h]hPAGE_IS_PFNZERO}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh - Page has zero PFN}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhj5 hhhhhNubj )}(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}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj-ubh+ - Page is PMD-mapped THP or Hugetlb backed}(hj-hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj)ubah}(h]h ]h"]h$]h&]uh1jhj5 hhhhhNubj )}(h+``PAGE_IS_SOFT_DIRTY`` - Page is soft-dirtyh]h)}(hjPh](h)}(h``PAGE_IS_SOFT_DIRTY``h]hPAGE_IS_SOFT_DIRTY}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjRubh - Page is soft-dirty}(hjRhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjNubah}(h]h ]h"]h$]h&]uh1jhj5 hhhhhNubj )}(h4``PAGE_IS_GUARD`` - Page is a part of a guard regionh]h)}(hjuh](h)}(h``PAGE_IS_GUARD``h]h PAGE_IS_GUARD}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjwubh# - Page is a part of a guard region}(hjwhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjsubah}(h]h ]h"]h$]h&]uh1jhj5 hhhhhNubj )}(h``PAGE_IS_ACCESSED`` - Page in a ``UFFDIO_REGISTER_MODE_RWP`` VMA has been accessed since RWP was applied. Only reported inside such VMAs. See Documentation/admin-guide/mm/userfaultfd.rst for the RWP workflow. h]h)}(h``PAGE_IS_ACCESSED`` - Page in a ``UFFDIO_REGISTER_MODE_RWP`` VMA has been accessed since RWP was applied. Only reported inside such VMAs. See Documentation/admin-guide/mm/userfaultfd.rst for the RWP workflow.h](h)}(h``PAGE_IS_ACCESSED``h]hPAGE_IS_ACCESSED}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh - Page in a }(hjhhhNhNubh)}(h``UFFDIO_REGISTER_MODE_RWP``h]hUFFDIO_REGISTER_MODE_RWP}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh VMA has been accessed since RWP was applied. Only reported inside such VMAs. See Documentation/admin-guide/mm/userfaultfd.rst for the RWP workflow.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhj5 hhhhhNubeh}(h]h ]h"]h$]h&]jmj& uh1jhhhKhj\ hhubh)}(h@The ``struct pm_scan_arg`` is used as the argument of the IOCTL.h](hThe }(hjhhhNhNubh)}(h``struct pm_scan_arg``h]hstruct pm_scan_arg}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh& is used as the argument of the IOCTL.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj\ 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 ``walk_end``. 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]jw)}(hhh](j )}(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 }(hjhhhNhNubh)}(h``struct pm_scan_arg``h]hstruct pm_scan_arg}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh must be specified in the }(hjhhhNhNubh)}(h``size``h]hsize}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh] field. This field will be helpful in recognizing the structure if extensions are done later.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hjubah}(h]h ]h"]h$]h&]uh1jhjubj )}(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 }(hj=hhhNhNubh)}(h ``flags``h]hflags}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj=ubh field. The }(hj=hhhNhNubh)}(h``PM_SCAN_WP_MATCHING``h]hPM_SCAN_WP_MATCHING}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj=ubh and }(hj=hhhNhNubh)}(h``PM_SCAN_CHECK_WPASYNC``h]hPM_SCAN_CHECK_WPASYNC}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1hhj=ubh are the only added flags at this time. The get operation is optionally performed depending upon if the output buffer is provided or not.}(hj=hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hj9ubah}(h]h ]h"]h$]h&]uh1jhjubj )}(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&]uh1jhjubj )}(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 ``walk_end``.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 ``walk_end``.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 }(hjhhhNhNubh)}(h ``walk_end``h]hwalk_end}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubj )}(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 }(hjhhhNhNubh)}(h``struct page_region``h]hstruct page_region}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh array and size is specified in }(hjhhhNhNubh)}(h``vec``h]hvec}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh and }(hjhhhNhNubh)}(h ``vec_len``h]hvec_len}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubj )}(hHThe optional maximum requested pages are specified in the ``max_pages``.h]h)}(hj<h](h:The optional maximum requested pages are specified in the /}(hj>hhhNhNubh)}(h ``max_pages``h]h max_pages}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj>ubh.}(hj>hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj:ubah}(h]h ]h"]h$]h&]uh1jhjubj )}(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 }(hjghhhNhNubh)}(h``category_mask``h]h category_mask}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhjgubh, }(hjghhhNhNubh)}(h``category_anyof_mask``h]hcategory_anyof_mask}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjgubh, }(hjghhhNhNubh)}(h``category_inverted``h]hcategory_inverted}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjgubh and }(hjghhhNhNubh)}(h``return_mask``h]h return_mask}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjgubh.}(hjghhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjcubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]jjjhjjuh1jvhjubah}(h]h ]h"]h$]h&]uh1hhhhM hj\ 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_WP_MATCHING | 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_WP_MATCHING | PM_SCAN_CHECK_WPASYNC, .. .category_mask = PAGE_IS_WRITTEN, .return_mask = PAGE_IS_WRITTEN, };}hjsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1jhhhMhj\ 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:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM#hj\ hhubj)}(hX1struct pm_scan_arg arg = { .size = sizeof(arg), .flags = 0, .. .category_mask = PAGE_IS_WRITTEN | PAGE_IS_FILE, .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]hX1struct pm_scan_arg arg = { .size = sizeof(arg), .flags = 0, .. .category_mask = PAGE_IS_WRITTEN | PAGE_IS_FILE, .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, };}hjsbah}(h]h ]h"]h$]h&]jjuh1jhhhM&hj\ 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 }(hj hhhNhNubh)}(h``PAGE_IS_WRITTEN``h]hPAGE_IS_WRITTEN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubhX 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.)}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM1hj\ 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:}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM6hj\ 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]jw)}(hhh](j )}(hHThe userfaultfd file descriptor is created with ``userfaultfd`` syscall.h]h)}(hjBh](h0The userfaultfd file descriptor is created with }(hjDhhhNhNubh)}(h``userfaultfd``h]h userfaultfd}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjDubh syscall.}(hjDhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM9hj@ubah}(h]h ]h"]h$]h&]uh1jhj=ubj )}(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 }(hjmhhhNhNubh)}(h``UFFD_FEATURE_WP_UNPOPULATED``h]hUFFD_FEATURE_WP_UNPOPULATED}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjmubh and }(hjmhhhNhNubh)}(h``UFFD_FEATURE_WP_ASYNC``h]hUFFD_FEATURE_WP_ASYNC}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjmubh features are set by }(hjmhhhNhNubh)}(h``UFFDIO_API``h]h UFFDIO_API}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjmubh IOCTL.}(hjmhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM:hjiubah}(h]h ]h"]h$]h&]uh1jhj=ubj )}(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}(hjhhhNhNubah}(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&]uh1hhhhM<hjubah}(h]h ]h"]h$]h&]uh1jhj=ubj )}(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 }(hjhhhNhNubh)}(h``PAGEMAP_SCAN``h]h PAGEMAP_SCAN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh IOCTL with flag }(hjhhhNhNubh)}(h``PM_SCAN_WP_MATCHING``h]hPM_SCAN_WP_MATCHING}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh or the }(hjhhhNhNubh)}(h``UFFDIO_WRITEPROTECT``h]hUFFDIO_WRITEPROTECT}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhk IOCTL can be used. Both of these perform the same operation. The former is better in terms of performance.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM>hjubah}(h]h ]h"]h$]h&]uh1jhj=ubj )}(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 }(hjEhhhNhNubh)}(h``PAGEMAP_SCAN``h]h PAGEMAP_SCAN}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjEubh 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.}(hjEhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMBhjAubah}(h]h ]h"]h$]h&]uh1jhj=ubeh}(h]h ]h"]h$]h&]jjjhjjuh1jvhj9ubah}(h]h ]h"]h$]h&]uh1hhhhM9hj\ 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 j j j j j j$ j! jY jV j|jyu nametypes}(jj j j j$ jY j|uh}(jhj j3j jj j j! j jV j' jyj\ 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)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehʌlineKuh1j hjrubatransform_messages] transformerN include_log] decorationNhhub.