Skip to content

Reverse map

include/mem/rmap.h View source View on GitHub

The way that rmap goes is:

page -> folio -> mapping object (file_vma, anon_vma) -> traverse interval tree -> for each matching avc -> vma_range -> addr

typedef void (*rmap_visit_fn)(
    struct mm * mm,
    vaddr_t va,
    struct folio * f,
    void * private
)
source

visitor invoked for each confirmed (mm, va) mapping the folio

void rmap_walk_anon(
    struct folio *f,
    rmap_visit_fn visit,
    void *private
)
source
void folio_add_anon_rmap(
    struct folio *f,
    struct vma_range *vm_area,
    vaddr_t va
)
source

fault path: first PTE to map this folio

void folio_add_anon_rmap_shared(
    struct folio *f,
    struct vma_range *vm_area
)
source

additional mapper

void folio_remove_rmap(struct folio *f, struct vma_range *vm_area)
source

a PTE stops mapping it

void folio_add_anon_rmap_new(
    struct folio *f,
    struct vma_range *vm_area,
    vaddr_t va
)
source