folio_add_file_rmap_pmd(9)
β¨ folio_add_file_rmap_pmd β¨
okay so bestie, this is a page from the Kernel API Manual and honestly? it's giving "niche but iconic" π
this little function lives in folio_add_file_rmap_pmd(9) land and its whole job is literally adding a PMD mapping to a page range of a folio. no cap. let's get into it π«Ά
πΈ NAME πΈ
folio_add_file_rmap_pmd β add a PMD mapping to a page range of a folio β¨
π SYNOPSIS π
void folio_add_file_rmap_pmd (struct folio *folio , struct page *page ,
struct vm_area_struct *vma );
that's the whole vibe right there π three pointers, one function, zero drama (as long as you read the DESCRIPTION section, which you will, because I said so π).
π¦ ARGUMENTS π¦
folioβ the folio you're adding the mapping to π like, the main character of this whole operation.pageβ the first page to add. yes, first. there are more. keep reading. πvmaβ the vm area in which the mapping gets added π that's the neighborhood the mapping is moving into.
π DESCRIPTION π
so the page range of the folio is defined by [page, page + HPAGE_PMD_NR) β that's the exact spec, don't come for me, I'm just the messenger β¨ and yeah, HPAGE_PMD_NR is doing a lot of heavy lifting there, bestie. it ate. π
π¨ okay important thing, listen up: the caller needs to hold the page table lock. this is not optional, this is not a suggestion, this is the vibe check you must pass before calling this function. fr fr. π₯
β SEE ALSO β
all the neighbors in the Kernel file ./mm/rmap.c β a whole group chat of functions, and yes they all get named, I'm not skipping a single one because that would be rude π:
__anon_vma_prepare(9)anon_vma_clone(9)unlink_anon_vmas(9)page_address_in_vma(9)folio_referenced(9)mapping_wrprotect_range(9)pfn_mkclean_range(9)folio_move_anon_rmap(9)__folio_set_anon(9)__page_check_anon_rmap(9)folio_add_anon_rmap_ptes(9)folio_add_anon_rmap_pmd(9)folio_add_new_anon_rmap(9)folio_add_file_rmap_ptes(9)folio_add_file_rmap_pud(9)folio_remove_rmap_ptes(9)folio_remove_rmap_pmd(9)folio_remove_rmap_pud(9)try_to_unmap(9)try_to_migrate(9)make_device_exclusive(9)__rmap_walk_file(9)
like, that's the whole squad right there, iykyk πΈ
and that's the page, diva π sourced straight from ./mm with a date stamp of October 2026 β love that for us, a little time traveler moment π§ stay locked, stay mapped, and remember the page table lock, mwah ππ«Ά
π¦ 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