folio_add_anon_rmap_pmd(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– folio_add_anon_rmap_pmd πŸ’–

okay bestie, so this is a page straight outta the Kernel API Manual and it's genuinely kinda iconic β€” it's about adding a PMD mapping to a page range of an anon folio. yes, that's a real sentence, and yes, we're gonna get through it together 🫢


✨ NAME ✨

folio_add_anon_rmap_pmd β€” add a PMD mapping to a page range of an anon folio πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

void folio_add_anon_rmap_pmd (struct folio *folio , struct page *page ,
       struct vm_area_struct *vma , unsigned long address , rmap_t flags );

like, look at her go. five arguments, zero notes πŸ’€


🌸 ARGUMENTS 🌸

  • folio β€” the folio we're adding the mapping to, the main character ofc πŸ‘‘
  • page β€” the first page to add. the opener, the headliner, page #1 ✨
  • vma β€” the vm area in which the mapping is added πŸ¦‹
  • address β€” the user virtual address of the first page to map 🎯
  • flags β€” the rmap flags. that's it, that's the whole description, ngl πŸ™ˆ

🧚 DESCRIPTION 🧚

so the page range of folio is defined by [first_page, first_page + HPAGE_PMD_NR) β€” that bracket is closed on the left and open on the right, she's precise like that πŸ’…

⚠️ real talk, bestie: the caller needs to hold the page table lock, and the page must be locked in the anon_vma case β€” that's to serialize mapping,index checking after setting. don't skip this, fr fr 😭

🌈 SEE ALSO 🌈

kernel file ./mm/rmap.c plus the whole friend group:


and that's the whole page, bestie, no cap πŸ“ this lil gem lives over in ./mm and it's dated October 2026, filed under the Kernel API Manual β€” go off, folio_add_anon_rmap_pmd(9), you ate πŸ’–βœ¨

πŸ“¦ where this page comes from