folio_try_s...non_rmap_pte(9)
π 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:
folio_dup_file_rmap_ptes(9)folio_dup_file_rmap_pmd(9)folio_try_dup_anon_rmap_ptes(9)folio_try_dup_anon_rmap_pmd(9)folio_try_share_anon_rmap_pmd(9)page_vma_mapped_walk_restart(9)
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
- 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