try_to_unmap(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ 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:

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