page_vma_mapped_walk(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’…βœ¨ page_vma_mapped_walk(9) βœ¨πŸ’…

okay so this is a page from the Kernel API Manual bestie, and it's genuinely important so buckle up πŸŽ€


🌸 NAME 🌸

page_vma_mapped_walk β€” literally just checks if @pvmw->pfn is mapped inside @pvmw->vma at @pvmw->address πŸ’–

⭐ SYNOPSIS ⭐

bool page_vma_mapped_walk (struct page_vma_mapped_walk *pvmw );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • pvmw β€” a pointer to struct page_vma_mapped_walk, no cap. but like, the rules are strict: page, vma, address and flags must be set already, and pmd, pte and ptl must be NULL. it's giving "fill out the form before you walk" 🫢

πŸ’œ DESCRIPTION πŸ’œ

so it returns true if the page is mapped in the vma, periodt. when that happens, pvmw->pmd and pvmw->pte point to the relevant page table entries, pvmw->ptl is locked, and pvmw->address gets adjusted if that's needed (looking at you, PTE-mapped THPs πŸ‘€).

if pvmw->pmd is set but pvmw->pte is not, congrats bestie, you found a PMD-mapped page (usually a THP). but for PTE-mapped THP you gotta run page_vma_mapped_walk in a loop to find all the PTEs that map the THP β€” yep, a whole loop, she's thorough πŸ’…

for HugeTLB pages, pvmw->pte is set to the relevant page table entry regardless of which page table level the page is mapped at, and pvmw->pmd is NULL. iconic behaviour honestly 🌈

it returns false when there are no more page table entries for the page in the vma β€” and then pvmw->ptl is unlocked and pvmw->pte is unmapped.

⚠️ and if you need to bail out of the walk before page_vma_mapped_walk returned false, use page_vma_mapped_walk_done β€” she does the housekeeping for you so you don't leave a mess 😭✨

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole vibe, bestie 🌸 this one's straight from ./mm, dated October 2026 β€” mwah, go map some pages, ily πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from