memory-managementlinux-kernel

Reverse Map to PTEs from a page frame


Currently, I am going through Linux Memory Management. And I am trying to modify a page table entry of a process. I got to know that there is a Reverse Mapping from a page frame (struct page)to a list of PTEs, and I need to unmap the PTE I am modifying.

On studying, I got to know that the reverse mapping is carried out with the help of anon_vma data structure. However, I could not find any field of type anon_vmain struct page data structure.

I am going through Understanding the Linux Virtual Memory Manager and Understanding the Linux Kernel books. However, these books are quite old.

I would like to know how the reverse mapping from struct page to a list of vma is done.


Solution

  • Alright, I found out the answer. When PAGE_MAPPING_ANON bit is set, page->mapping points to anon vma of the respective page. It has been documented here. The mapping field points to different data structures based on the flag.