mas_alloc_cyclic(9)
π mas_alloc_cyclic(9) π
okay so bestie, real talk: this is the Kernel API Manual page for mas_alloc_cyclic, and it's literally the internal call that goes "hiiii where do I put this entry π
". It's the Maple Tree's little matchmaker for finding somewhere to store an entry. Periodt.
β¨ NAME β¨
mas_alloc_cyclic β Internal call to find somewhere to store an entry
like, it's not the public-facing bestie, it's the internal one. iykyk.
π SYNOPSIS π
int mas_alloc_cyclic (struct ma_state *mas , unsigned long *startp ,
void *entry , unsigned long range_lo , unsigned long range_hi , unsigned
long *next , gfp_t gfp );
no cap, that's the whole signature. don't touch a single character of it π
π¦ ARGUMENTS π¦
okay the vibe check on every single parameter, one by one, because we do not skip:
masβ The maple state. this is the main character of the whole operation, fr.startpβ Pointer to ID. it points at where the ID lives πentryβ The entry to store. the actual thing we're putting in, iconic.range_loβ Lower bound of range to search. the floor of the search zone.range_hiβ Upper bound of range to search. the ceiling of the search zone.nextβ Pointer to next ID to allocate. yes hello, next in line please πΈgfpβ TheGFP_FLAGSto use for allocations. the allocation energy, if you will β¨
π₯ RETURN π₯
it returns an int, and here's how to read the results, bestie:
0β the allocation succeeded without wrapping. clean run, no drama. slay π«Ά1β the allocation succeeded after wrapping. it looped around and still came through. resilient queen π-EBUSYβ there are no free entries. fully booked, nothing available, it's giving sold out π
no third option, no vibes-based guessing β those are the only three outcomes, so check your return value properly π
π SEE ALSO π
Kernel file ./lib/maple_tree.c, and literally the entire extended friend group of functions:
mas_prealloc_calc(9)mas_wr_preallocate(9)mas_insert(9)mas_walk(9)mte_dead_walk(9)mt_free_walk(9)mas_store(9)mas_store_gfp(9)mas_store_prealloc(9)mas_preallocate(9)mas_next(9)mas_next_range(9)mt_next(9)mas_prev(9)mas_prev_range(9)mt_prev(9)mas_pause(9)mas_find_setup(9)mas_find(9)mas_find_range(9)mas_find_rev_setup(9)mas_find_rev(9)mas_find_range_rev(9)mas_erase(9)mas_nomem(9)mas_nomem_nofail(9)mtree_load(9)mtree_store_range(9)mtree_store(9)mtree_insert_range(9)mtree_insert(9)mtree_alloc_cyclic(9)mtree_erase(9)__mt_dup(9)mtree_dup(9)__mt_destroy(9)mtree_destroy(9)mt_find(9)mt_find_after(9)
that's the whole group chat, everyone invited π
ngl, this one's internal β so if you're reading it, you're either deep in ./lib/maple_tree.c or you're just curious. either way, proud of you π§
okay that's the page!! π this lil number lives in ./lib, drops in October 2026, and goes by mas_alloc_cyclic(9) β catch you in the source, bestie, 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