walk_page_mapping(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ walk_page_mapping(9) β€” Kernel API Manual πŸ¦‹

okay bestie, welcome to walk_page_mapping(9) β€” the Kernel API Manual page that's literally all about strolling through every memory area mapped into a struct address_space. It's giving very thorough walk energy, ngl. πŸ’…

🌸 NAME 🌸

walk_page_mapping β€” walk all memory areas mapped into a struct address_space.

✨ SYNOPSIS ✨

int walk_page_mapping (struct address_space *mapping , pgoff_t
       first_index , pgoff_t nr , const struct mm_walk_ops *ops , void *private
       );

πŸŽ€ ARGUMENTS πŸŽ€

  • mapping β€” pointer to the struct address_space. That's the main character of this walk, periodt.
  • first_index β€” first page offset in the address_space.
  • nr β€” number of incremental page offsets to cover. Basically how much of the index range we're visiting.
  • ops β€” operation to call during the walk.
  • private β€” private data for callbacks' usage.

πŸ’… DESCRIPTION πŸ’…

This function walks all memory areas mapped into a struct address_space. The walk is limited to only the given page-size index range, but if the index boundaries cross a huge page-table entry, that entry will be included. So yes, bestie, it can spill a little past the edge when a huge page-table entry is involved β€” that's intentional, not a glitch. 🫢

Also see walk_page_range for additional information.

Locking tea β˜•: this function can't require that the struct mm_struct::mmap_lock is held, since mapping may be mapped by multiple processes. Instead, mapping->i_mmap_rwsem must be held. This might have implications in the callbacks, and it's up to the caller to ensure that the struct mm_struct::mmap_lock is not needed.

Also this means that a caller can't rely on the struct vm_area_struct::vm_flags to be constant across a call, except for immutable flags. Callers requiring this shouldn't use this function. No cap β€” if you need those flags to stay put, this is not the function for you. πŸ’€

⭐ RETURN ⭐

  • 0 on success
  • negative error code on failure
  • positive number on caller defined premature termination

🌈 SEE ALSO 🌈


mwah πŸ’‹ that's the whole page, bestie β€” source/version ./mm, dated October 2026. walk_page_mapping(9) out! πŸŽ€βœ¨

πŸ“¦ where this page comes from