__rmap_walk_file(9)
π
__rmap_walk_file β Kernel API Manual, bestie edition π¦
okay so picture this: we're deep in the kernel, right, and we need to stroll through the reverse mapping of a file-backed mapping. Yeah. That mapping. The one belonging to a page that lives inside a specific page cache object, at a specific offset. That's the whole vibe of this function. It's giving guided tour of VMAs and honestly? iconic. β¨
πΈ NAME πΈ
__rmap_walk_file β traverse the reverse mapping for a file-backed mapping of a page mapped within a specified page cache object at a specified offset. no cap, that's literally it π
π SYNOPSIS π
void __rmap_walk_file (struct folio *folio , struct address_space
*mapping , pgoff_t pgoff_start , unsigned long nr_pages , struct
rmap_walk_control *rwc , bool locked );
β¨ ARGUMENTS β¨
okay bestie, here's the cast of characters, and you need to know all of them:
folioβ either the folio whose mappings we're traversing, or, if it'sNULL, then the callbacks specified inrwcget configured such as to be able to look up mappings correctly. so it's either "here's the folio, go" or "we're doing this the abstract way" π«Άmappingβ the page cache object whose mapping VMAs we intend to traverse. and listen: iffoliois non-NULL, this should be equal tofolio_mapping(folio). keep them in sync, babe πpgoff_startβ the offset withinmappingof the page which we are looking up. iffoliois non-NULL, this should be equal tofolio_pgoff(folio). again with the matching, it's a whole thing πnr_pagesβ the number of pages mapped by the mapping. and yes, iffoliois non-NULL, this should be equal tofolio_nr_pages(folio). three for three, slay βrwcβ the reverse mapping walk control object describing how the traversal should proceed. this is the main character right here, it's literally the whole itinerary πlockedβ is the mapping already locked? if not, we acquire the lock. no worries, we handle it, but like... tell us upfront π
π₯ SEE ALSO π₯
kernel file ./mm/rmap.c and its whole friend group, fr fr:
__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_unmap(9)try_to_migrate(9)make_device_exclusive(9)
they're all in ./mm and they all ate, lowkey π
and that's the page, bestie!! this little masterpiece lives in ./mm and it's dated October 2026 β future-proof and fabulous, we love to see it π§π go forth and traverse those mappings responsibly, ily π
π¦ 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