__rmap_walk_file(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… __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's NULL, then the callbacks specified in rwc get 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: if folio is non-NULL, this should be equal to folio_mapping(folio). keep them in sync, babe πŸ’…
  • pgoff_start β€” the offset within mapping of the page which we are looking up. if folio is non-NULL, this should be equal to folio_pgoff(folio). again with the matching, it's a whole thing πŸŽ€
  • nr_pages β€” the number of pages mapped by the mapping. and yes, if folio is non-NULL, this should be equal to folio_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:

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