gen_pool_set_algo(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… gen_pool_set_algo β€” like, the manual page bestie

okay so this is gen_pool_set_algo(9) from the Kernel API Manual ✨ β€” yes, that's the same name as the title, we're not being subtle, it's the function and it's the main character. Scroll down and I'll tell you everything 🫢


🌸 NAME

gen_pool_set_algo β€” set the allocation algorithm πŸ’«

That's it. That's the whole vibe. You're swapping out how this pool picks a chunk. Iconic behavior, honestly.


✨ SYNOPSIS

void gen_pool_set_algo (struct gen_pool *pool , genpool_algo_t algo ,
       void *data );

Like, it takes three things and gives you nothing back β€” void return, no notes, no drama, it just does the thing πŸ’… (spoiler: nothing gets returned, don't @ me, that's literally what the synopsis says)


πŸŽ€ ARGUMENTS

  • pool β€” the pool you're changing the allocation algorithm on. Your girl. Your project. 🌸
  • algo β€” a custom algorithm function. That's the whole point, bestie, this is the function you're installing πŸ”₯
  • data β€” additional data used by algo. Extra stuff it needs. It gets handed over to your algo, iykyk ✨

πŸ¦‹ DESCRIPTION

okay so here's the tea β˜•: this calls algo for each memory allocation in the pool. Every single one. No skipping, no shortcuts, no "ugh not this one again" πŸ™ˆ

And if algo is NULL? No worries β€” it uses gen_pool_first_fit as the default memory allocation function πŸŽ€ so you literally cannot break it by passing nothing. It's got a backup plan. Lowkey so thoughtful of it 🫢

ngl, this is the "change the strategy mid-game" move. The pool keeps on pooling, it just pools differently now πŸ’«

πŸ‘‘ SEE ALSO

Kernel file ./lib/genalloc.c πŸ“ β€” that's where the real magic lives, go look:

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_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)

the whole friend group, fr fr 🌈


that's the page, bestie πŸ’œ this one comes from the source directory ./lib, dated October 2026 β€” stay hydrated, keep your pools aligned, and slay βœ¨πŸ’…πŸŽ€

πŸ“¦ where this page comes from