I want to know a better way of "naming things" (regarding memory management in linux), to avoid a reader of a writting of mine to misunderstood something, but also avoid long-phrases each time.
- I call file-backed to a page that, in case of reclaim, can be just discarded because their contents can be retrieved from disk again. However, when focusing in that sense of "file-backed = can be just discarded in case of page reclaim", I don't know if there are special cases where pages can be discarded in case of page reclaim, but still cannot be considered file-backed. Consider the special zero-page: it cannot be reclaim though, but its contents are "constant". If a virtual page is mapped to the zero-page, you can safely "unmap" it, because you can "map it again" without losing information. Is there cases where the assertion "can be discarded in case of page reclaim" doesn't match well with the idea of file-backed page? Or there's actually an if and only if between both concepts?
- Distinguish between virtual memory as in the whole addressable range, with virtual memory as in the currently existing virtual pages.
- Regarding "mapping": if I say, mapping a page, what does it mean, creating a new virtual page and put it somewhere within the whole addressable range, or by "page mapping" one means: "associating a virtual page with a page in RAM after a page fault"? When a page is swapped out and then moved to RAM later again, is it correct to say "page mapping" to refer to these second situation where the virtual page, that was previously mapped to a page in swap, is now pointing to the new RAM page?
- Physical page: does it exclusively mean a page in RAM, or a page that have a physical presence somewhere (RAM or disk)?
- I want to distinguish between a virtual page that is "mapped" to a page that lives somewhere, with the page itself that lives somewhere. I like to use "unused page" to mean a virtual page mapped with no one, and so the situation I'm describing here is the opposite of that. But if I say "used page", I don't know if that can be understood as "recently referenced" or something like that. For example, a virtual page mapped to the zero-page is not a physical page, the zero-page is, but I don't know how to proper name both concepts.
- I want to distinguish between a page that is meant to be shared with a page that is actually shared. For example, a page that is mapped to the
.text
section of the binary itself. The page is meant to be shared or potentially shared (in other words, is not meant to be private). However, if it's actually shared or not depends if there's more than on process executing the same binary. Same with "private": a page can be private, or shared but meant to be private. For example, CoW virtual pages like those mapped to the zero-page or inherited from the parent process after afork
: both are shared but meant to be private. I want to know how to distinguish both situations with a name. - Anonymous versus file-backed page: yet another cause of confusion. Consider the following situation: a dynamically linked library is virtually mapped to a proccess when run. No RAM-pages has been allocated yet. The
.so
file has a 8kB.data
section with some global variables. Some of the global variables have been accessed, and then both pages are RAM-allocated. These are truly file-backed pages yet (in case of page reclaim, they can be discarded instead of moved to swap). Now, some variables are modified, causing the two pages to detach from the file, and so become anonymous (and so they can no longer be discarded). However, if Icat smaps
I will see the corresponding address range refering to the file (inode different from 0, and the path of the.so
file shown); however, both pages are anonymous now (theAnonymous
field of thesmaps
output will be equal to8 kB
). Here, the "address-range" is refered to a file, but however, none of its pages are file-backed now. Is there a way to distinguish between a page or a range that "refers to a file", or that is "comes from a file", or that they were "file-backed" at some point in the past, with pages that are file-backed right now?