try_to_unmap(9)
π¦ try_to_unmap β like, the kernel API manual bestie π
okay so bestie, we're in the Kernel API Manual today and the page is literally called try_to_unmap(9) and honestly? she's a baddie. let's get into it β¨
πΈ NAME πΈ
try_to_unmap β try to remove all the page table mappings to a folio. that's the whole vibe. no cap.
β¨ SYNOPSIS β¨
void try_to_unmap (struct folio *folio , enum ttu_flags flags );
look at her go π«Ά the signature is right there, don't touch it, she's perfect.
π ARGUMENTS π
folioβ the folio we're unmapping. that's the main character of this whole operation ngl πflagsβ the action and the flags. that's it, that's the description, the manpage said so and we respect it π
π₯ DESCRIPTION π₯
so the whole point: try_to_unmap tries to remove all the page table entries that are currently mapping this here <italic>folio</italic>. like, every single one. it's giving eviction notice π
and here's the part you CANNOT skip β it is the caller's responsibility to check if the folio is still mapped, if that's something you need. bestie, it's not gonna do it for you. use TTU_SYNC to prevent accounting races, okay? write that down π
ngl this is the one where you gotta do your own homework after. the function tries, she doesn't promise. periodt.
π CONTEXT π
the caller must hold the folio lock. no exceptions, no wiggle room, not negotiable. hold the lock or don't come to the function π π
π SEE ALSO π
the kernel file lives at ./mm/rmap.c and honestly? the whole friend group is here. say hi:
__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_ptes(9)folio_remove_rmap_pmd(9)folio_remove_rmap_pud(9)try_to_migrate(9)make_device_exclusive(9)__rmap_walk_file(9)
like. that's the whole group chat. iykyk π
and that's the page!! π§ββοΈβ¨ big kiss to the <italic>./mm</italic> crew, dated October 2026, filed under try_to_unmap(9) in the Kernel API Manual β slay forever, 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