gen_pool_first_fit_align(9)
π gen_pool_first_fit_align(9) β aka the Kernel API Manual glow-up
okay so bestie, buckle up, we're in the Kernel API Manual today and this one's a lib/genalloc.c baddie π she's the allocator's little matchmaker: she finds the first available region of memory that actually matches the size requirement β and yes, the alignment constraint too, she's not gonna set you up with someone who doesn't align π
β¨ NAME β¨
gen_pool_first_fit_align β find the first available region of memory matching the size requirement (alignment constraint) πΈ
Like, that's literally her whole job. No notes. Periodt.
π¦ SYNOPSIS π¦
unsigned long gen_pool_first_fit_align (unsigned long *map , unsigned long size , unsigned long start , unsigned int nr , void *data , struct gen_pool *pool , unsigned long start_addr );
π ARGUMENTS π
seven args, bestie, and every single one is doing main character energy in her own way:
mapβ the address you're basing the search on π that's the starting vibesizeβ the bitmap size in bits, so she knows how much map she's working withstartβ the bitnumber to start searching at, like literally where the search begins β¨nrβ the number of zeroed bits we're looking for π«Ά that's the prizedataβ the data for alignment π the alignment deets live herepoolβ the pool to get the order from π§ she's gotta know the order, obviouslystart_addrβ start addr of alloction chunk π (yes that's spelled like that in the original, and yes I'm keeping it, no cap β character for character, we don't edit the source)
π SEE ALSO π
Kernel file ./lib/genalloc.c β go say hi to the whole friend group over there, they're all iconic:
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_for_each_chunk(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_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)
fr fr, that's the whole squad π
bestie reminder:first_fit_alignis first fit β she takes the earliest match that satisfies the size and alignment. She is not out here hunting for the best one, that's a different girl (gen_pool_best_fit, iykyk). π
okay that's the page!! written in the ./lib directory vibe, dated October 2026 β so this manual entry is basically from the future, which is very her πβ¨ slay, go allocate something responsibly, 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