folio_remove_rmap_ptes(9)
π folio_remove_rmap_ptes β a little guide from the Kernel API Manual π
okay so bestie, gather round, because this one is genuinely important and honestly kind of iconic. We're talking about folio_remove_rmap_ptes β the function that yeets PTE mappings off a page range of a folio. No cap, that's the whole personality. π¦
β¨ SYNOPSIS β¨
void folio_remove_rmap_ptes (struct folio *folio , struct page *page ,
int nr_pages , struct vm_area_struct *vma );
look at her. four args, returns nothing (void β she gives, she doesn't take π
). Copy it exactly if you're typing it out, mkay?
π ARGUMENTS π
folioβ the folio you're removing the mappings from. main character energy, fr.pageβ the first page to remove. like, the starting point of the whole situation.nr_pagesβ how many pages get removed from the mapping. the count. the vibes. the number.vmaβ the vm area the mappings are being removed from. lowkey essential.
πΈ DESCRIPTION πΈ
so the page range of the folio is defined by [page, page + nr_pages) β yes, half-open interval, the brackets are doing the Lord's work, note the ) at the end, not a ]. β¨
β οΈ big one: the caller needs to hold the page table lock. Not optional. Not a suggestion. Hold the lock or perish (metaphorically, but likeβ¦ don't test it π).
π¦ SEE ALSO π¦
the whole friend group, in the order the page says, because I respect the source material:
- Kernel file
./mm/rmap.c __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_pmd(9)folio_add_file_rmap_pud(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)
π sign-off π
and that's the whole page, bestie! π«Ά she lives in ./mm, she's stamped October 2026, and that's the Kernel API Manual tea for today. go hold that page table lock. slay. periodt. π
β¨π
π¦ 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