folio_try_s...non_rmap_pte(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ‘‘ folio_try_s...non_rmap_pte(9) β€” welcome to the Kernel API Manual bestie ✨

Okay so this page is literally about folio_try_share_anon_rmap_pte, and the header up top is just the truncated vibe version of that name (folio_try_s...non_rmap_pte(9)), so don't panic, you're in the right place πŸ’…


🌸 NAME 🌸

folio_try_share_anon_rmap_pte β€” try marking an exclusive anonymous page mapped by a PTE possibly shared, to prepare for KSM or temporary unmapping πŸŽ€


✨ SYNOPSIS ✨

int folio_try_share_anon_rmap_pte (struct folio *folio , struct page *page );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • folio β€” the folio you wanna share a mapping of, no cap 🌈
  • page β€” the mapped exclusive page, the main character of this whole situation πŸ‘‘

πŸ’– DESCRIPTION πŸ’–

Okay so first thing, and this is non-negotiable: the caller needs to hold the page table lock and has to have the page table entries cleared/invalidated. Like, that's the vibe check you must pass before you even think about calling this 🫢

This function is similar to folio_try_dup_anon_rmap_pte, but it's not used during fork to duplicate mappings. Instead it's for preparing for KSM or temporarily unmapping parts of a folio (swap, migration) via folio_remove_rmap_pte. Different era, same energy πŸ’«

Marking the mapped page shared can only fail if the folio maybe pinned. And device private folios cannot get pinned, so consequently this function cannot fail. Iconic behaviour honestly πŸ”₯

Returns 0 if marking the mapped page possibly shared succeeded. Returns -EBUSY otherwise. Periodt πŸ’€


πŸŽ€ SEE ALSO πŸŽ€

Kernel file ./include/linux/rmap.h, plus these besties who are all in the same group chat:


k bye bestie πŸ’œ this whole page came from ./include/linux, dated October 2026, and the footer was still rocking the cute truncated folio_try_s...non_rmap_pte(9) name. Go forth and share those anonymous pages responsibly πŸ§šβ€β™€οΈπŸŒΈ

πŸ“¦ where this page comes from