xas_find_marked(9)
π xas_find_marked β like, the whole page, bestie
okay so you're in the Kernel API Manual and the function is xas_find_marked(9) β yes, the (9) is the section, it's giving kernel-internals realness, we love that for us β¨
πΈ NAME πΈ
xas_find_marked β finds the next marked entry in the XArray. that's it, that's the whole vibe. π
β¨ SYNOPSIS β¨
void * xas_find_marked (struct xa_state *xas , unsigned long max ,
xa_mark_t mark );
(note the space before the commas in that signature β that's how it's written, we do not edit the queen's handwriting π )
π¦ ARGUMENTS π¦
xasβ the XArray operation state. it's the little luggage the operation carries around with it, yep.maxβ the highest index to return. like, the ceiling, the boundary, the "do not pass go past here" index π§markβ the mark number to search for. which little tag you're hunting for π
π DESCRIPTION π
okay this is the part where it gets good. so picture this:
if the xas has not yet been walked to an entry, we return the marked entry which has an index >= xas.xa_index. simple, clean, iconic.
if it has been walked, then the entry currently being pointed at has already been processed β been there, done that β so we return the first marked entry with an index > xas.xa_index. note the strictly-greater, no cap, that's not a typo, it's the whole point π
and then, bestie, the two endings:
- no marked entry found AND the array is smaller than
max? thenxasis set to the bounds state, andxas->xa_indexis set to the smallest index not yet in the array. the payoff?xascan be immediately passed toxas_storeβ like, no extra steps, immediately, we're so efficient. π - no entry found before
maxis reached? thenxasis set to the restart state. that's the "womp womp, try again" state π
π₯ RETURN π₯
the entry, if found. otherwise NULL. that's it. that's the return value. short and slay. π«Ά
π SEE ALSO π
kernel file ./lib/xarray.c, plus the entire friend group (fr fr, this is the full list, every single one):
xas_load(9), xas_nomem(9), xas_free_nodes(9), xas_create_range(9), xas_store(9), xas_get_mark(9), xas_set_mark(9), xas_clear_mark(9), xas_init_marks(9), xas_split_alloc(9), xas_split(9), xas_try_split_min_order(9), xas_try_split(9), xas_pause(9), xas_find(9), xas_find_conflict(9), xa_load(9), __xa_erase(9), xa_erase(9), __xa_store(9), xa_store(9), __xa_cmpxchg(9), __xa_insert(9), xa_store_range(9), xas_get_order(9), xa_get_order(9), __xa_alloc(9), __xa_alloc_cyclic(9), __xa_set_mark(9), __xa_clear_mark(9), xa_get_mark(9), xa_set_mark(9), xa_clear_mark(9), xa_find(9), xa_find_after(9), xa_extract(9), xa_delete_node(9), xa_destroy(9)
lowkey reminder: NULL is a real return value here, not a personality flaw. check for it, bestie. π
k byeee, this page lives in ./lib, dated October 2026 β signed, sealed, delivered, xoxo π§ππ·
π¦ 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