gen_pool_for_each_chunk(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 by func. your little care package that gets handed off to func every 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: the func is called with rcu_read_lock held. 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:

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