page_vma_mapped_walk(9)
π β¨ 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 tostruct page_vma_mapped_walk, no cap. but like, the rules are strict:page,vma,addressandflagsmust be set already, andpmd,pteandptlmust beNULL. 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 beforepage_vma_mapped_walkreturnedfalse, usepage_vma_mapped_walk_doneβ she does the housekeeping for you so you don't leave a mess πβ¨
π SEE ALSO π
- Kernel file
./mm/page_vma_mapped.ccheck_pte(9),page_mapped_in_vma(9)π₯
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms