Commit 5b32e44e authored by Tiberiu A Georgescu's avatar Tiberiu A Georgescu Committed by Jonathan Corbet

Documentation: update pagemap with shmem exceptions

Mentioning the current missing information in the pagemap and alternatives
on how to retrieve it, in case someone stumbles upon unexpected behaviour.
Signed-off-by: default avatarTiberiu A Georgescu <tiberiu.georgescu@nutanix.com>
Reviewed-by: default avatarIvan Teterevkov <ivan.teterevkov@nutanix.com>
Reviewed-by: default avatarFlorian Schmidt <florian.schmidt@nutanix.com>
Reviewed-by: default avatarCarl Waldspurger <carl.waldspurger@nutanix.com>
Reviewed-by: default avatarJonathan Davies <jonathan.davies@nutanix.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Reviewed-by: default avatarPeter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/20210923064618.157046-2-tiberiu.georgescu@nutanix.comSigned-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 92a19d80
......@@ -196,6 +196,28 @@ you can go through every map in the process, find the PFNs, look those up
in kpagecount, and tally up the number of pages that are only referenced
once.
Exceptions for Shared Memory
============================
Page 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.
In 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).
In user space, whether the page is present, swapped or none can be deduced with
the help of lseek and/or mincore system calls.
lseek() 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/``.
mincore() can differentiate between pages in memory (present, including swap
cache) and out of memory (swapped out or none/non-allocated).
Other notes
===========
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment