gen_pool_for_each_chunk(9)
π gen_pool_for_each_chunk(9) π
okay so bestie, we're in the Kernel API Manual (that's the manual name, iykyk) and today's main character is a function that just... loops over stuff for you. no cap. let's get into it π¦
β¨ NAME β¨
gen_pool_for_each_chunk β call func for every chunk of generic memory pool. that's it. that's the whole vibe. π
π SYNOPSIS π
void gen_pool_for_each_chunk (struct gen_pool *pool , void
(*func)(struct gen_pool *pool, struct gen_pool_chunk *chunk, void *data)
, void *data );
literally copy it exactly, don't @ me π
π ARGUMENTS π
poolβ the generic memory pool. the pool in question. the one we're strolling through πΈfuncβ func to call. yes, that's the actual description. the callback. the thing that runs per chunk π«Άdataβ additional data used byfunc. your little care package that gets handed off tofuncevery time β¨
π₯ DESCRIPTION π₯
Call func for every chunk of generic memory pool. that's the whole bit β no tricks, no secret sauce.
β οΈ okay but here's the important part, lowkey the most important part: thefuncis called withrcu_read_lockheld. so if your callback was thinking about sleeping or doing something spicy, maybe don't π treat that lock like it's holding your iced coffee and you can't spill it.
π SEE ALSO π
so the kernel file is ./lib/genalloc.c (go read it, it's giving source-of-truth π), and here's the whole friend group β every single one of them, no skips:
gen_pool_create(9)gen_pool_add_owner(9)gen_pool_virt_to_phys(9)gen_pool_destroy(9)gen_pool_alloc_algo_owner(9)gen_pool_dma_alloc(9)gen_pool_dma_alloc_algo(9)gen_pool_dma_alloc_align(9)gen_pool_dma_zalloc(9)gen_pool_dma_zalloc_algo(9)gen_pool_dma_zalloc_align(9)gen_pool_free_owner(9)gen_pool_has_addr(9)gen_pool_avail(9)gen_pool_size(9)gen_pool_set_algo(9)gen_pool_first_fit(9)gen_pool_first_fit_align(9)gen_pool_fixed_alloc(9)gen_pool_first_fit_order_align(9)gen_pool_best_fit(9)gen_pool_get(9)devm_gen_pool_create(9)of_gen_pool_get(9)
like, the whole fam fr fr π§
mwah β this page lives under ./lib, stamped October 2026, and yes it's signed gen_pool_for_each_chunk(9) on the way out. slay, go iterate some chunks πβ
π¦ 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