mt_for_each(9)
πΈ NAME πΈ
okay so bestie, this is mt_for_each(9) from the Kernel API Manual, and itβs giving tiny iterator macro with main character energy β¨. Itβs literally here to iterate over each entry starting at index until max. Thatβs highkey the whole gig. Iconic. Periodt π
β¨ SYNOPSIS β¨
mt_for_each (__tree , __entry , __index , __max );
π ARGUMENTS π
__treeβ The Maple Tree. Yes, the tree itself, the whole vibe π³.__entryβ The current entry. Like, the one youβre on right now in the loop π.__indexβ The index to start the search from. Subsequently used as iterator. So it starts the search and then keeps doing iterator duty β lowkey a double shift π .__maxβ The maximum limit for index. The ceiling, the cap, the βthatβs enoughβ line π.
π¦ DESCRIPTION π¦
This iterator skips all entries, which resolve to a NULL pointer, e.g. entries which has been reserved with XA_ZERO_ENTRY. No cap, it just quietly passes over them like βnot my entry, not my problemβ π. Keep that in mind so you donβt get confused when your loop behaves like itβs skipping stuff β because it literally is π.
bestie note: the skip is for entries that resolve to aNULLpointer, andXA_ZERO_ENTRY-reserved entries are the example. Thatβs the tea β.
π SEE ALSO π
- Kernel file
./include/linux/maple_tree.h Maple tree flags(9)MTREE_INIT(9)MTREE_INIT_EXT(9)mtree_empty(9)mas_reset(9)mas_for_each(9)mas_for_each_rev(9)__mas_set_range(9)mas_set_range(9)mas_set(9)mt_init_flags(9)mt_init(9)mt_clear_in_rcu(9)mt_set_in_rcu(9)
xoxo, your kernel bestie π«Ά β this mt_for_each(9) moment comes from source/version ./include/linux, dated October 2026. Bye bestie, go iterate slayfully π
β¨
π¦ 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