walk_page_mapping(9)
π¦ 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 thestruct address_space. That's the main character of this walk, periodt.first_indexβ first page offset in theaddress_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 β
0on success- negative error code on failure
- positive number on caller defined premature termination
π SEE ALSO π
- Kernel file
./mm/pagewalk.c walk_page_range(9)walk_kernel_page_table_range(9)walk_page_range_debug(9)folio_walk_start(9)
mwah π that's the whole page, bestie β source/version ./mm, dated October 2026. walk_page_mapping(9) out! πβ¨
π¦ 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