for_each_pt_level_entry(9)
π for_each_pt_level_entry β kernel API manual, bestie edition β¨
okay so real quick: this is a page from the kernel API manual, and the star of the show is for_each_pt_level_entry. she's a macro, she's a loop, she's lowkey carrying the whole iteration situation. let's get into it π«Ά
πΈ NAME πΈ
for_each_pt_level_entry β literally just a for-loop wrapper over the entries in the range. that's her whole job. iconic of her honestly π
π SYNOPSIS π
for_each_pt_level_entry (pts );
one argument, no drama, we love a low-maintenance signature π
π¦ ARGUMENTS π¦
ptsβ the iteration state. she holds the vibes (and the state) for the walk. main character energy fr fr.
β¨ DESCRIPTION β¨
so this is the basic iteration primitive β the moment the whole thing kicks off. it iterates over all the entries in pts->range that fall within the pts's current table level (like, only the ones on this level, not the whole tree, know what i mean?).
and every single step? it does pt_load_entry(pts). no cap. each one. that's the whole loop body vibe check β
ngl she's small but she's the foundation β every fancier walker downstream is basically her with extra steps π
π SEE ALSO π
kernel file ./drivers/iommu/generic_pt/pt_iter.h β go read the source, iykyk π
and the whole friend group, in alphabetical-ish order of how the page lists them:
pt_check_range(9)pt_index_to_va(9)pt_entry_fully_covered(9)pt_range_to_index(9)pt_range_to_end_index(9)pt_next_entry(9)pt_load_single_entry(9)pt_top_range(9)pt_all_range(9)pt_upper_range(9)pt_make_range(9)pt_init(9)pt_init_top(9)pt_descend(9)pt_walk_range(9)pt_range_slice(9)pt_top_memsize_lg2(9)pt_compute_best_pgsize(9)PT_MAKE_LEVELS(9)
like a whole squad of pt_* besties and not one of them skipped ππ
that's the page!! this came out of ./drivers/iommu/generic_pt, dated October 2026 β so yeah, mark your calendars, screenshot it, send it to the group chat, mwah ππ
π¦ 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