xas_set_update(9)
π
xas_set_update β the xas_set_update(9) page, but make it make sense
okay so before we even start: this is a page from the Kernel API Manual, and the star of the show is xas_set_update, bestie. It lives in the kernel docs, it's giving very "advanced XArray internals" energy, and honestly? It's kinda iconic in a quiet way. Let's get into it π
β¨ NAME β¨
xas_set_update β the little function that sets up XArray operation state so you can hand it a callback. periodt.
πΈ SYNOPSIS πΈ
void xas_set_update (struct xa_state *xas , xa_update_node_t update );
look at her. two args, returns nothing, does exactly what it says π
π¦ ARGUMENTS π¦
xasβ your XArray operation state, aka the whole vibe container you're working inside. this is the struct you're decorating β¨updateβ the function to call whenever a node gets updated. yes, that's a function as an argument, we're being fancy today π
π DESCRIPTION π
okay so here's the tea π β the XArray can notify a caller after it has updated an xa_node. that's the whole point of this function.
and lowkey? this is advanced functionality. it's not a casual little helper you sprinkle on everything. the manual is very clear that it's only needed by the page cache and the swap cache. so if you're not in those two clubs, bestie, you probably don't need this one. no cap.
genuinely: "advanced functionality" is the manpage's own words. don't go adding update callbacks to everything just because you can. main character energy is knowing when to sit down π
π SEE ALSO π
the kernel file to check out is ./include/linux/xarray.h, and the whole extended friend group is huge, so buckle up π§
value & pointer helpers:
xa_mk_value(9)xa_to_value(9)xa_is_value(9)xa_tag_pointer(9)xa_untag_pointer(9)xa_pointer_tag(9)xa_is_zero(9)xa_is_err(9)xa_err(9)
structs & definition macros:
struct xa_limit(9)struct xarray(9)DEFINE_XARRAY_FLAGS(9)DEFINE_XARRAY(9)DEFINE_XARRAY_ALLOC(9)DEFINE_XARRAY_ALLOC1(9)xa_init_flags(9)xa_init(9)xa_empty(9)xa_marked(9)
iteration (the xa_for_each crew):
store / erase / compare-and-swap / insert / alloc / reserve:
xa_store_bh(9)xa_store_irq(9)xa_erase_bh(9)xa_erase_irq(9)xa_cmpxchg(9)xa_cmpxchg_bh(9)xa_cmpxchg_irq(9)xa_insert(9)xa_insert_bh(9)xa_insert_irq(9)xa_alloc(9)xa_alloc_bh(9)xa_alloc_irq(9)xa_alloc_cyclic(9)xa_alloc_cyclic_bh(9)xa_alloc_cyclic_irq(9)xa_reserve(9)xa_reserve_bh(9)xa_reserve_irq(9)xa_release(9)
predicates & type:
the XA_STATE setup macros:
the xas_ state functions (our girl's direct siblings):
xas_error(9)xas_set_err(9)xas_invalid(9)xas_valid(9)xas_is_node(9)xas_reset(9)xas_retry(9)xas_reload(9)xas_set(9)xas_advance(9)xas_set_order(9)
the xas_ iteration squad:
xas_next_entry(9)xas_next_marked(9)xas_for_each(9)xas_for_each_marked(9)xas_for_each_conflict(9)xas_prev(9)xas_next(9)
like I said. huge friend group. all of them are in ./include/linux/xarray.h territory, iykyk π₯
that's the whole page bestie, you ate it up π
cute little sign-off: this one comes to you from ./include/linux, dated October 2026, and yeah β that's the source, the version, and the date all in one lil bow π now go forth and only set update callbacks if you're genuinely doing page cache or swap cache things, fr fr π
π¦ 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